[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RESEND v2 2/7] qga/channel-posix: Plug memory leak in ga_channel_
From: |
Chen Qun |
Subject: |
[PATCH RESEND v2 2/7] qga/channel-posix: Plug memory leak in ga_channel_write_all() |
Date: |
Fri, 23 Oct 2020 14:12:13 +0800 |
From: Pan Nengyuan <pannengyuan@huawei.com>
Missing g_error_free on error path in ga_channel_write_all(). Fix that.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
---
qga/channel-posix.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index 0373975360..8f3821af6d 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -249,7 +249,7 @@ GIOStatus ga_channel_write_all(GAChannel *c, const gchar
*buf, gsize size)
buf += written;
} else if (status != G_IO_STATUS_AGAIN) {
g_warning("error writing to channel: %s", err->message);
- return status;
+ goto out;
}
}
@@ -261,6 +261,10 @@ GIOStatus ga_channel_write_all(GAChannel *c, const gchar
*buf, gsize size)
g_warning("error flushing channel: %s", err->message);
}
+out:
+ if (err) {
+ g_error_free(err);
+ }
return status;
}
--
2.23.0
- [PATCH RESEND v2 0/7] some memleak trivial patchs, Chen Qun, 2020/10/23
- [PATCH RESEND v2 4/7] elf2dmp/pdb: Plug memleak in pdb_init_from_file, Chen Qun, 2020/10/23
- [PATCH RESEND v2 7/7] block/file-posix: fix a possible undefined behavior, Chen Qun, 2020/10/23
- [PATCH RESEND v2 1/7] tests/migration: fix memleak in wait_command/wait_command_fd, Chen Qun, 2020/10/23
- [PATCH RESEND v2 5/7] migration/colo: Plug memleaks in colo_process_incoming_thread, Chen Qun, 2020/10/23
- [PATCH RESEND v2 2/7] qga/channel-posix: Plug memory leak in ga_channel_write_all(),
Chen Qun <=
- [PATCH RESEND v2 3/7] elf2dmp/qemu_elf: Plug memleak in QEMU_Elf_init, Chen Qun, 2020/10/23
- [PATCH RESEND v2 6/7] blockdev: Fix a memleak in drive_backup_prepare(), Chen Qun, 2020/10/23
- RE: [PATCH RESEND v2 0/7] some memleak trivial patchs, Chenqun (kuhn), 2020/10/30