elementary_codegen: check before use to avoid use after free
authorStefan Schmidt <s.schmidt@samsung.com>
Fri, 20 Sep 2019 10:11:39 +0000 (12:11 +0200)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 23 Sep 2019 21:32:19 +0000 (06:32 +0900)
These might or might not have been freed already, depending on the
breaks form the above loop. Before we are having a use after free here
better check on it before free'ing another time.

Coverity IDs: 1402671, 1402701

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D10047

src/bin/elementary/elementary_codegen.c

index 2f8324f..28ed576 100644 (file)
@@ -701,9 +701,13 @@ _programs_parse(Evas_Object *ed)
           }
 
         edje_edit_string_free(description);
+        description = NULL;
         edje_edit_string_free(sig);
+        sig = NULL;
         edje_edit_string_free(source);
+        source = NULL;
         free(apiname);
+        apiname = NULL;
      }
 
    edje_edit_string_list_free(programs);