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 <[email protected]>
> ---
>  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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to