vppapigen: resource leakage in fromjson array - coverity 23/31323/1
authorOle Troan <ot@cisco.com>
Wed, 17 Feb 2021 12:46:54 +0000 (13:46 +0100)
committerOle Troan <ot@cisco.com>
Wed, 17 Feb 2021 12:46:54 +0000 (13:46 +0100)
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I43283c59fd121dcb2486b26151108c90b027748b

src/tools/vppapigen/vppapigen_c.py

index 759d332..a83d361 100644 (file)
@@ -380,7 +380,7 @@ class FromJSON():
         int i;
         cJSON *array = cJSON_GetObjectItem(o, "{n}");
         int size = cJSON_GetArraySize(array);
-        if (size != {lfield}) return 0;
+        if (size != {lfield}) goto error;
         for (i = 0; i < size; i++) {{
             cJSON *e = cJSON_GetArrayItem(array, i);
             {call}