virsh: don't call virSecretFree on NULL

Since the refactoring in fbe2d49 we call virSecretFree even if
virSecretDefineXML fails, which leads to overwriting the error
message with:
error: Invalid secret: virSecretFree

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=929045
(cherry picked from commit bfb4b822579ce1afcbc396fe4bc3b57fb3ebc150)
This commit is contained in:
Ján Tomko 2013-03-29 12:55:38 +01:00
parent 752b683c1b
commit 66e8f041f9

View File

@ -117,6 +117,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
cleanup: cleanup:
VIR_FREE(buffer); VIR_FREE(buffer);
if (res)
virSecretFree(res); virSecretFree(res);
return ret; return ret;
} }