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; goto done;
if (xmldb_dump(h, stdout, xt, WITHDEFAULTS_REPORT_ALL) < 0) if (xmldb_dump(h, stdout, xt, WITHDEFAULTS_REPORT_ALL) < 0)
goto done; goto done;
if (xt)
xml_free(xt);
exit(0); /* This is fairly abrupt , but need to avoid side-effects of rewinding 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. */ 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 */ /* Merge xml into db2. Without commit */
retval = xmldb_put(h, (char*)db2, OP_MERGE, xt, clicon_username_get(h), cbret); retval = xmldb_put(h, (char*)db2, OP_MERGE, xt, clicon_username_get(h), cbret);
done: done:
if (xt)
xml_free(xt);
return retval; return retval;
} }
@ -278,9 +280,9 @@ tmp |-------+-----+-----+
reset extrafile reset extrafile
*/ */
int int
startup_extraxml(clixon_handle h, startup_extraxml(clixon_handle h,
char *file, char *file,
cbuf *cbret) cbuf *cbret)
{ {
int retval = -1; int retval = -1;
char *tmp_db = "tmp"; char *tmp_db = "tmp";
@ -334,6 +336,8 @@ startup_extraxml(clixon_handle h,
ok: ok:
retval = 1; retval = 1;
done: done:
if (xt)
xml_free(xt);
if (xt0) if (xt0)
xml_free(xt0); xml_free(xt0);
if (xmldb_delete(h, tmp_db) != 0 && errno != ENOENT) if (xmldb_delete(h, tmp_db) != 0 && errno != ENOENT)

View file

@ -598,6 +598,7 @@ function wait_backend(){
err "backend timeout $DEMWAIT seconds" err "backend timeout $DEMWAIT seconds"
fi fi
done done
stty $STTYSETTINGS >/dev/null
} }
# Start restconf daemon # Start restconf daemon