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
This commit is contained in:
Ján Tomko 2013-03-29 12:55:38 +01:00
parent 2d73f2120f
commit bfb4b82257

View File

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