Fixed several backend memory leacks

This commit is contained in:
Olof hagsand 2024-02-18 17:55:38 +01:00
parent 01327fc8f0
commit 8f2601bfdf
3 changed files with 10 additions and 3 deletions

View file

@ -253,6 +253,8 @@ startup_common(clixon_handle h,
goto done;
if (xmldb_dump(h, stdout, xt, WITHDEFAULTS_REPORT_ALL) < 0)
goto done;
if (xt)
xml_free(xt);
exit(0); /* This is fairly abrupt , but need to avoid side-effects of rewinding
stack. Alternative is to make a separate function stack for this. */
}

View file

@ -93,6 +93,8 @@ db_merge(clixon_handle h,
/* Merge xml into db2. Without commit */
retval = xmldb_put(h, (char*)db2, OP_MERGE, xt, clicon_username_get(h), cbret);
done:
if (xt)
xml_free(xt);
return retval;
}
@ -278,9 +280,9 @@ tmp |-------+-----+-----+
reset extrafile
*/
int
startup_extraxml(clixon_handle h,
char *file,
cbuf *cbret)
startup_extraxml(clixon_handle h,
char *file,
cbuf *cbret)
{
int retval = -1;
char *tmp_db = "tmp";
@ -334,6 +336,8 @@ startup_extraxml(clixon_handle h,
ok:
retval = 1;
done:
if (xt)
xml_free(xt);
if (xt0)
xml_free(xt0);
if (xmldb_delete(h, tmp_db) != 0 && errno != ENOENT)