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