halcc: Add checking halcc_manifest_add_hal() return value 78/305978/2
authorYunhee Seo <yuni.seo@samsung.com>
Wed, 14 Feb 2024 10:10:06 +0000 (19:10 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Tue, 27 Feb 2024 11:16:39 +0000 (20:16 +0900)
If halcc_manifest_add_hal() returns error, halcc_hal should be free.
Omitted handling code is added.

Change-Id: Ic566968760537f2375cd84e25b877115beeaddb3
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
halcc/src/halcc-parser.c

index 4b12c2f..53adae4 100644 (file)
@@ -264,7 +264,14 @@ static int parse_manifest(xmlNode *node, halcc_manifest *manifest)
                        continue;
                }
 
-               halcc_manifest_add_hal(manifest, h);
+               ret = halcc_manifest_add_hal(manifest, h);
+               if (ret != 0) {
+                       printf("Failed to halcc_manifest_add_hal(), ret=%d\n", ret);
+                       halcc_hal_free(h);
+                       h = NULL;
+                       continue;
+               }
+
                h = NULL;
        }