Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
int type;
char *desc = NULL;
char *desc_edited = NULL;
- char *tmp = NULL;
char *tmpstr;
const vshCmdOpt *opt = NULL;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
}
if (edit) {
+ g_autoptr(vshTempFile) tmp = NULL;
+
/* Create and open the temporary file. */
if (!(tmp = vshEditWriteToTempFile(ctl, desc)))
goto cleanup;
cleanup:
VIR_FREE(desc_edited);
VIR_FREE(desc);
- if (tmp) {
- unlink(tmp);
- VIR_FREE(tmp);
- }
return ret;
}