projects
/
project
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
418f63b
)
handler: Fix memory leak
author
Hans Dedecker
<dedeckeh@gmail.com>
Mon, 1 Feb 2016 09:56:25 +0000
(10:56 +0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Mon, 1 Feb 2016 10:09:57 +0000
(11:09 +0100)
Call globfree to free dynamically allocated storage from a previous glob call
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
handler.c
patch
|
blob
|
history
diff --git
a/handler.c
b/handler.c
index f81a7c581510fe6b4dd7613388cafa8dcdbbd3e3..0c4627f1ca549429c63a3e3809a47d5bf4429b7e 100644
(file)
--- a/
handler.c
+++ b/
handler.c
@@
-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 *