[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] colo-proxy: fix memory leak
From: |
Zhang Chen |
Subject: |
[Qemu-devel] [PATCH] colo-proxy: fix memory leak |
Date: |
Mon, 10 Oct 2016 17:46:54 +0800 |
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);
}
return res;
diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index 89abe72..396a03c 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -75,8 +75,8 @@ static int handle_primary_tcp_pkt(NetFilterState *nf,
ntohl(tcp_pkt->th_seq), ntohl(tcp_pkt->th_ack),
tcp_pkt->th_flags);
trace_colo_filter_rewriter_conn_offset(conn->offset);
- g_free(sdebug);
- g_free(ddebug);
+ free(sdebug);
+ free(ddebug);
}
if (((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == TH_SYN)) {
@@ -123,8 +123,8 @@ static int handle_secondary_tcp_pkt(NetFilterState *nf,
ntohl(tcp_pkt->th_seq), ntohl(tcp_pkt->th_ack),
tcp_pkt->th_flags);
trace_colo_filter_rewriter_conn_offset(conn->offset);
- g_free(sdebug);
- g_free(ddebug);
+ free(sdebug);
+ free(ddebug);
}
if (((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == (TH_ACK | TH_SYN))) {
@@ -162,6 +162,7 @@ static ssize_t colo_rewriter_receive_iov(NetFilterState *nf,
iov_to_buf(iov, iovcnt, 0, buf, size);
pkt = packet_new(buf, size);
+ g_free(buf);
/*
* if we get tcp packet
--
2.7.4
- [Qemu-devel] [PATCH] colo-proxy: fix memory leak,
Zhang Chen <=