Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/openvz/openvz_conf.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 94c3baf87f..d2acbc2606 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -978,23 +978,18 @@ static int openvzAssignUUIDs(void) int openvzGetVEID(const char *name) { - virCommand *cmd; - char *outbuf; + g_autoptr(virCommand) cmd = NULL; + g_autofree char *outbuf = NULL; char *temp; int veid; bool ok; cmd = virCommandNewArgList(VZLIST, name, "-ovpsid", "-H", NULL); virCommandSetOutputBuffer(cmd, &outbuf); - if (virCommandRun(cmd, NULL) < 0) { - virCommandFree(cmd); - VIR_FREE(outbuf); + if (virCommandRun(cmd, NULL) < 0) return -1; - } - virCommandFree(cmd); ok = virStrToLong_i(outbuf, &temp, 10, &veid) == 0 && *temp == '\n'; - VIR_FREE(outbuf); if (ok && veid >= 0) return veid; -- 2.31.1