summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-01-06 13:58:00 +0100
committerDave Barach <openvpp@barachs.net>2021-01-06 17:05:40 +0000
commit86cff9cdaaffd795795c80e5bc0874390a14b3e1 (patch)
tree0b8c3ba6394bfaa2a6291f841b54b6db92c9f2a5 /src/tools
parent803c1623c255a6ffbc41e81a1bbd17bffba2ed05 (diff)
api: fromjson/tojson generated code memory leak
Found by coverity. Fix potential memory leakage in generated code. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: If492541b8b66e574f30ecdd0dd533099cbe068ad
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/vppapigen/vppapigen_c.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py
index 66e0c2f084c..0727619a803 100644
--- a/src/tools/vppapigen/vppapigen_c.py
+++ b/src/tools/vppapigen/vppapigen_c.py
@@ -553,7 +553,7 @@ class FromJSON():
write(' item = cJSON_GetObjectItem(o, "{}");\n'
.format(t.fieldname))
- write(' if (!item) return 0;\n')
+ write(' if (!item) { free(a); return 0; }\n')
self._dispatch[t.type](self, t, toplevel=True)
write('\n')