projects
/
oweals
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fa40c4e
)
Fix memory leak in uci_list_config_files
author
Justin Bronder
<jsbronder@brontes3d.com>
Tue, 1 Dec 2009 16:13:41 +0000
(11:13 -0500)
committer
Felix Fietkau
<nbd@openwrt.org>
Tue, 1 Dec 2009 18:15:57 +0000
(19:15 +0100)
When glob returns non-zero, the path buffer was not unallocated.
file.c
patch
|
blob
|
history
diff --git
a/file.c
b/file.c
index 6b41d683b3dd903067fe5cbba51249354f726e2a..c6a30950cafc25a5c5f235974c91cb4df0b1f148 100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-494,8
+494,10
@@
static char **uci_list_config_files(struct uci_context *ctx)
dir = uci_malloc(ctx, strlen(ctx->confdir) + 1 + sizeof("/*"));
sprintf(dir, "%s/*", ctx->confdir);
- if (glob(dir, GLOB_MARK, NULL, &globbuf) != 0)
+ if (glob(dir, GLOB_MARK, NULL, &globbuf) != 0) {
+ free(dir);
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
+ }
size = sizeof(char *) * (globbuf.gl_pathc + 1);
for(i = 0; i < globbuf.gl_pathc; i++) {