Memory leak in cli load_config_file

This commit is contained in:
Olof hagsand 2022-07-27 17:40:49 +02:00
parent bed6d3c739
commit b0d38a513c

View file

@ -828,7 +828,7 @@ load_config_file(clicon_handle h,
FILE *fp = NULL;
cxobj *xt = NULL;
cxobj *x;
cbuf *cbxml;
cbuf *cbxml = NULL;
char *formatstr = NULL;
enum format_enum format = FORMAT_XML;
yang_stmt *yspec;
@ -952,10 +952,11 @@ load_config_file(clicon_handle h,
replace?OP_REPLACE:OP_MERGE,
cbuf_get(cbxml)) < 0)
goto done;
cbuf_free(cbxml);
ok:
ret = 0;
done:
if (cbxml)
cbuf_free(cbxml);
if (lineptr)
free(lineptr);
if (xerr)