diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2016-02-01 10:56:25 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2016-02-01 11:09:57 +0100 |
commit | cf9033dd5ac75cb3c8c2fd55011f3ec5cd4c2371 (patch) | |
tree | ab9971ce5896f91e298d79be9cfca2f9c57c61a0 /handler.c | |
parent | 418f63b98f8cc9a4316f7dce4889400afd6ca3aa (diff) |
handler: Fix memory leak
Call globfree to free dynamically allocated storage from a previous glob call
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'handler.c')
-rw-r--r-- | handler.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -128,10 +128,14 @@ void netifd_init_script_handlers(int dir_fd, script_dump_cb cb) int i, prev_fd; prev_fd = netifd_dir_push(dir_fd); - glob("./*.sh", 0, NULL, &g); + if (glob("./*.sh", 0, NULL, &g)) + return; + for (i = 0; i < g.gl_pathc; i++) netifd_parse_script_handler(g.gl_pathv[i], cb); netifd_dir_pop(prev_fd); + + globfree(&g); } char * |