summaryrefslogtreecommitdiff
path: root/validate
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2016-12-17 17:12:28 -0800
committerJohn Crispin <john@phrozen.org>2016-12-19 08:53:10 +0100
commitdb070f15ac559e3bd406cb8b8cccf40f78e75094 (patch)
treeef8247c449c24e0309337b15cb82ce87509e00b5 /validate
parentacc48b553adfbdba77a5fa19e11bf7d69c65d596 (diff)
downloadubox-db070f15ac559e3bd406cb8b8cccf40f78e75094.tar.gz
ubox: Fix some memory leaks
Avoids leaking memory when exiting early. Signed-off by: Rosen <rosenp@gmail.com>
Diffstat (limited to 'validate')
-rw-r--r--validate/validate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/validate/validate.c b/validate/validate.c
index 5bc3bc4..0628407 100644
--- a/validate/validate.c
+++ b/validate/validate.c
@@ -173,8 +173,10 @@ dt_type_list(struct dt_state *s, int nargs)
char *p, *str = strdup(s->value);
const char *value = s->value;
- if (!str || !nargs)
+ if (!str || !nargs) {
+ free(str);
return false;
+ }
for (p = strtok(str, " \t"); p; p = strtok(NULL, " \t"))
{