提交 f582199e 编写于 作者: A Alex Jia 提交者: Eric Blake

virsh: plug memory leak on cmdDomIfGetLink() sucessful path

Detected by valgrind. Leak introduced in commit dc675f37:

* tools/virsh.c: fix memory leak on cmdDomIfGetLink.

* how to reproduce?
  % valgrind -v --leak-check=full virsh domif-getlink <domain name> 0

* actual valgrind result:

==13102== 18 bytes in 1 blocks are definitely lost in loss record 9 of 47
==13102==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==13102==    by 0x322A6A67DD: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
==13102==    by 0x414892: cmdDomIfGetLink (virsh.c:1538)
==13102==    by 0x4136A2: vshCommandRun (virsh.c:16363)
==13102==    by 0x4253FB: main (virsh.c:17865)
==13102==
==13102== LEAK SUMMARY:
==13102==    definitely lost: 18 bytes in 1 blocks
==13102==    indirectly lost: 0 bytes in 0 blocks
==13102==      possibly lost: 0 bytes in 0 blocks
==13102==    still reachable: 127,888 bytes in 1,361 blocks
==13102==         suppressed: 0 bytes in 0 blocks
Signed-off-by: NAlex Jia <ajia@redhat.com>
上级 ecf75f83
...@@ -1541,6 +1541,7 @@ cmdDomIfGetLink (vshControl *ctl, const vshCmd *cmd) ...@@ -1541,6 +1541,7 @@ cmdDomIfGetLink (vshControl *ctl, const vshCmd *cmd)
VIR_FREE(mac); VIR_FREE(mac);
goto hit; goto hit;
} }
VIR_FREE(mac);
} }
cur = cur->next; cur = cur->next;
} }
...@@ -6400,7 +6401,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) ...@@ -6400,7 +6401,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
} }
} }
ret = true; ret = true;
goto cleanup; goto cleanup;
} else { } else {
/* Set the block I/O throttle, match by opt since parameters can be 0 */ /* Set the block I/O throttle, match by opt since parameters can be 0 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册