Memory leaks and errors

This commit is contained in:
Olof Hagsand 2019-03-21 20:36:47 +01:00
parent 3f68cca06c
commit 10d45bcee3
5 changed files with 11 additions and 9 deletions

View file

@ -111,7 +111,9 @@ backend_terminate(clicon_handle h)
stream_publish_exit(); stream_publish_exit();
clixon_plugin_exit(h); clixon_plugin_exit(h);
/* Delete all backend plugin RPC callbacks */ /* Delete all backend plugin RPC callbacks */
rpc_callback_delete_all(); rpc_callback_delete_all(h);
/* Delete all backend plugin upgrade callbacks */
upgrade_callback_delete_all(h);
if (pidfile) if (pidfile)
unlink(pidfile); unlink(pidfile);

View file

@ -242,12 +242,12 @@ int clixon_plugin_auth(clicon_handle h, void *arg);
/* rpc callback API */ /* rpc callback API */
int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, char *namespace, char *name); int rpc_callback_register(clicon_handle h, clicon_rpc_cb cb, void *arg, char *namespace, char *name);
int rpc_callback_delete_all(void); int rpc_callback_delete_all(clicon_handle h);
int rpc_callback_call(clicon_handle h, cxobj *xe, cbuf *cbret, void *arg); int rpc_callback_call(clicon_handle h, cxobj *xe, cbuf *cbret, void *arg);
/* upgrade callback API */ /* upgrade callback API */
int upgrade_callback_register(clicon_handle h, clicon_upgrade_cb cb, void *arg, char *name, char *namespace, uint32_t from, uint32_t to); int upgrade_callback_register(clicon_handle h, clicon_upgrade_cb cb, void *arg, char *name, char *namespace, uint32_t from, uint32_t to);
int upgrade_callback_delete_all(void); int upgrade_callback_delete_all(clicon_handle h);
int upgrade_callback_call(clicon_handle h, cxobj *xt, char *modname, char *modns, uint32_t from, uint32_t to, cbuf *cbret); int upgrade_callback_call(clicon_handle h, cxobj *xt, char *modname, char *modns, uint32_t from, uint32_t to, cbuf *cbret);
#endif /* _CLIXON_PLUGIN_H_ */ #endif /* _CLIXON_PLUGIN_H_ */

View file

@ -72,9 +72,9 @@
* 1) the internal structure contains a header (defined here) whereas higher * 1) the internal structure contains a header (defined here) whereas higher
* order libs (eg cli and backend) introduce more fields appended to this * order libs (eg cli and backend) introduce more fields appended to this
* struct. * struct.
* 2) ch_options accessed via clicon_data() are clixon config options are * 2) ch_options accessed via clicon_options() are clixon config options are
* string values appearing in the XML configfile accessed with -f. * string values appearing in the XML configfile accessed with -f.
* Alternatively, these could be accessed via clicon_conf_xml() * Alternatively, these could be accessed via clicon_conf_xml()
* 3) ch_data accessed via clicon_data() is more general purpose for any data. * 3) ch_data accessed via clicon_data() is more general purpose for any data.
* that is, not only strings. And has separate namespace from options. * that is, not only strings. And has separate namespace from options.
*/ */

View file

@ -466,7 +466,7 @@ rpc_callback_register(clicon_handle h,
/*! Delete all RPC callbacks /*! Delete all RPC callbacks
*/ */
int int
rpc_callback_delete_all(void) rpc_callback_delete_all(clicon_handle h)
{ {
rpc_callback_t *rc; rpc_callback_t *rc;
@ -604,7 +604,7 @@ upgrade_callback_register(clicon_handle h,
/*! Delete all Upgrade callbacks /*! Delete all Upgrade callbacks
*/ */
int int
upgrade_callback_delete_all(void) upgrade_callback_delete_all(clicon_handle h)
{ {
upgrade_callback_t *uc; upgrade_callback_t *uc;

View file

@ -94,9 +94,9 @@ modstate_diff_free(modstate_diff_t *md)
if (md == NULL) if (md == NULL)
return 0; return 0;
if (md->md_del) if (md->md_del)
free(md->md_del); xml_free(md->md_del);
if (md->md_mod) if (md->md_mod)
free(md->md_mod); xml_free(md->md_mod);
free(md); free(md);
return 0; return 0;
} }