
于 2011年06月28日 21:10, Eric Blake 写道:
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.
ah, yes
+ 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.
Applied with the fix, thanks Osier