mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 20:46:50 +03:00
Monkey: Clean up various leaked blocks
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
b03786920a
commit
8b0aec4bac
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
typedef struct cmdhandler {
|
typedef struct cmdhandler {
|
||||||
struct cmdhandler *r_next, *r_prev;
|
struct cmdhandler *r_next, *r_prev;
|
||||||
const char *cmd;
|
char *cmd;
|
||||||
handle_command_fn fn;
|
handle_command_fn fn;
|
||||||
} monkey_cmdhandler_t;
|
} monkey_cmdhandler_t;
|
||||||
|
|
||||||
@ -49,6 +49,17 @@ monkey_register_handler(const char *cmd, handle_command_fn fn)
|
|||||||
return NSERROR_OK;
|
return NSERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
monkey_free_handlers(void)
|
||||||
|
{
|
||||||
|
while (handler_ring != NULL) {
|
||||||
|
monkey_cmdhandler_t *handler = handler_ring;
|
||||||
|
RING_REMOVE(handler_ring, handler);
|
||||||
|
free(handler->cmd);
|
||||||
|
free(handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
monkey_process_command(void)
|
monkey_process_command(void)
|
||||||
{
|
{
|
||||||
|
@ -25,4 +25,6 @@ nserror monkey_register_handler(const char *cmd, handle_command_fn fn);
|
|||||||
|
|
||||||
void monkey_process_command(void);
|
void monkey_process_command(void);
|
||||||
|
|
||||||
|
void monkey_free_handlers(void);
|
||||||
|
|
||||||
#endif /* NETSURF_MONKEY_DISPATCH_H */
|
#endif /* NETSURF_MONKEY_DISPATCH_H */
|
||||||
|
@ -380,6 +380,12 @@ main(int argc, char **argv)
|
|||||||
urldb_load(nsoption_charp(url_file));
|
urldb_load(nsoption_charp(url_file));
|
||||||
urldb_load_cookies(nsoption_charp(cookie_file));
|
urldb_load_cookies(nsoption_charp(cookie_file));
|
||||||
|
|
||||||
|
/* Free resource paths now we're done finding resources */
|
||||||
|
for (char **s = respaths; *s != NULL; s++) {
|
||||||
|
free(*s);
|
||||||
|
}
|
||||||
|
free(respaths);
|
||||||
|
|
||||||
ret = monkey_register_handler("QUIT", quit_handler);
|
ret = monkey_register_handler("QUIT", quit_handler);
|
||||||
if (ret != NSERROR_OK) {
|
if (ret != NSERROR_OK) {
|
||||||
die("quit handler failed to register");
|
die("quit handler failed to register");
|
||||||
@ -421,5 +427,8 @@ main(int argc, char **argv)
|
|||||||
/* finalise logging */
|
/* finalise logging */
|
||||||
nslog_finalise();
|
nslog_finalise();
|
||||||
|
|
||||||
|
/* And free any monkey-specific bits */
|
||||||
|
monkey_free_handlers();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user