projects
/
project
/
rpcd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d80f70e
)
plugin: exec: properly free memory on parse error
author
Yousong Zhou
<yszhou4tech@gmail.com>
Mon, 21 Oct 2019 06:10:26 +0000
(06:10 +0000)
committer
Jo-Philipp Wich
<jo@mein.io>
Tue, 26 May 2020 14:18:26 +0000
(16:18 +0200)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
(cherry picked from commit
cc502635046a2015d07fab5a21edbda7b7b98f38
)
plugin.c
patch
|
blob
|
history
diff --git
a/plugin.c
b/plugin.c
index fa5f09f932865a0ee1758c277eb95fdc1ef497c6..877345d7a9a635efb94f7e5e5ff223731c274176 100644
(file)
--- a/
plugin.c
+++ b/
plugin.c
@@
-321,11
+321,16
@@
rpc_plugin_parse_exec(const char *name, int fd)
obj_type = calloc(1, sizeof(*obj_type));
- if (!obj_type)
+ if (!obj_type) {
+ free(obj);
return NULL;
+ }
- if (asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name) < 0)
+ if (asprintf((char **)&obj_type->name, "luci-rpc-plugin-%s", name) < 0) {
+ free(obj);
+ free(obj_type);
return NULL;
+ }
obj_type->methods = methods;
obj_type->n_methods = n_method;