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 <zhangchen.f...@cn.fujitsu.com>
---
  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




Reply via email to