[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] colo-proxy: fix memory leak
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] colo-proxy: fix memory leak |
Date: |
Mon, 10 Oct 2016 15:23:10 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature