|
From: | Zhang Chen |
Subject: | Re: [Qemu-devel] [PATCH] colo-proxy: fix memory leak |
Date: | Tue, 11 Oct 2016 11:37:19 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 10/11/2016 04:23 AM, Eric Blake wrote:
On 10/10/2016 04:46 AM, Zhang Chen wrote:Fix memory leak in colo-compare.c and filter-rewriter.c Report by Coverity. Signed-off-by: Zhang Chen <address@hidden> --- net/colo-compare.c | 4 ++-- net/filter-rewriter.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 22b1da1..47e7ebe 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -235,8 +235,8 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt) fprintf(stderr, "Secondary len = %d\n", spkt->size); qemu_hexdump((char *)spkt->data, stderr, "colo-compare", spkt->size);- g_free(sdebug);- g_free(ddebug); + free(sdebug); + free(ddebug);Uggh. We should fix the original allocations of sdebug and ddebug to use g_strdup_printf() rather than strdup(), so that we are using a consistent allocator throughout. Or even improve this code to use traces instead of fprintf.
OK~~ I get your point. I will send patch V2 later. Thanks Zhang Chen
-- Thanks zhangchen
[Prev in Thread] | Current Thread | [Next in Thread] |