projects
/
qemu-gpiodev
/
libfuse.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c470934
)
Fix a potential resource leak (newargv)
author
Laszlo Papp
<ext-laszlo.papp@nokia.com>
Mon, 7 Mar 2011 12:33:38 +0000
(14:33 +0200)
committer
Miklos Szeredi
<mszeredi@suse.cz>
Wed, 30 Mar 2011 17:34:58 +0000
(19:34 +0200)
lib/fuse_opt.c
patch
|
blob
|
history
diff --git
a/lib/fuse_opt.c
b/lib/fuse_opt.c
index b15e7db11905b4f315fd99f0cac7231cb9368345..b9127645c65d7fa732e6962bd21c9146974f9218 100644
(file)
--- a/
lib/fuse_opt.c
+++ b/
lib/fuse_opt.c
@@
-54,10
+54,15
@@
int fuse_opt_add_arg(struct fuse_args *args, const char *arg)
assert(!args->argv || args->allocated);
+ newarg = strdup(arg);
+ if (!newarg)
+ return alloc_failed();
+
newargv = realloc(args->argv, (args->argc + 2) * sizeof(char *));
- newarg = newargv ? strdup(arg) : NULL;
- if (!newargv || !newarg)
+ if (!newargv) {
+ free(newarg);
return alloc_failed();
+ }
args->argv = newargv;
args->allocated = 1;