mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
colo-proxy: fix memory leak
Fix memory leak in colo-compare.c and filter-rewriter.c Report by Coverity and add some comments. Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com> Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
c7c3591669
commit
2061c14c9b
3 changed files with 20 additions and 30 deletions
|
@ -188,7 +188,6 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
|
|||
{
|
||||
struct tcphdr *ptcp, *stcp;
|
||||
int res;
|
||||
char *sdebug, *ddebug;
|
||||
|
||||
trace_colo_compare_main("compare tcp");
|
||||
if (ppkt->size != spkt->size) {
|
||||
|
@ -219,24 +218,21 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
|
|||
(spkt->size - ETH_HLEN));
|
||||
|
||||
if (res != 0 && trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
|
||||
sdebug = strdup(inet_ntoa(ppkt->ip->ip_src));
|
||||
ddebug = strdup(inet_ntoa(ppkt->ip->ip_dst));
|
||||
fprintf(stderr, "%s: src/dst: %s/%s p: seq/ack=%u/%u"
|
||||
" s: seq/ack=%u/%u res=%d flags=%x/%x\n",
|
||||
__func__, sdebug, ddebug,
|
||||
(unsigned int)ntohl(ptcp->th_seq),
|
||||
(unsigned int)ntohl(ptcp->th_ack),
|
||||
(unsigned int)ntohl(stcp->th_seq),
|
||||
(unsigned int)ntohl(stcp->th_ack),
|
||||
res, ptcp->th_flags, stcp->th_flags);
|
||||
trace_colo_compare_pkt_info(inet_ntoa(ppkt->ip->ip_src),
|
||||
inet_ntoa(ppkt->ip->ip_dst),
|
||||
ntohl(ptcp->th_seq),
|
||||
ntohl(ptcp->th_ack),
|
||||
ntohl(stcp->th_seq),
|
||||
ntohl(stcp->th_ack),
|
||||
res, ptcp->th_flags,
|
||||
stcp->th_flags,
|
||||
ppkt->size,
|
||||
spkt->size);
|
||||
|
||||
fprintf(stderr, "Primary len = %d\n", ppkt->size);
|
||||
qemu_hexdump((char *)ppkt->data, stderr, "colo-compare", ppkt->size);
|
||||
fprintf(stderr, "Secondary len = %d\n", spkt->size);
|
||||
qemu_hexdump((char *)spkt->data, stderr, "colo-compare", spkt->size);
|
||||
|
||||
g_free(sdebug);
|
||||
g_free(ddebug);
|
||||
qemu_hexdump((char *)ppkt->data, stderr,
|
||||
"colo-compare ppkt", ppkt->size);
|
||||
qemu_hexdump((char *)spkt->data, stderr,
|
||||
"colo-compare spkt", spkt->size);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue