
On 06/28/2011 03:16 AM, Osier Yang wrote:
Detected when playing with "make -C tests valgrind". --- tests/virnetmessagetest.c | 35 ++++++++++++++++++++++++----------- 1 files changed, 24 insertions(+), 11 deletions(-)
if (VIR_ALLOC(err.str3) < 0) - return -1; + goto cleanup; *err.str3 = strdup("Three");
+cleanup: + VIR_FREE(*err.message); + VIR_FREE(*err.str1); + VIR_FREE(*err.str2); + VIR_FREE(*err.str3);
Ouch - four potential NULL derefs. You need to write these as: if (err.str3) VIR_FREE(*err.str3); and so forth.
+ VIR_FREE(err.message); + VIR_FREE(err.str1); + VIR_FREE(err.str2); + VIR_FREE(err.str3);
But these four are okay.
+ return ret;
ACK with that fix. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org