core: check memory before usage.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Tue, 11 Dec 2012 09:25:28 +0000 (11:25 +0200)
committerIsmo Puustinen <ismo.puustinen@intel.com>
Tue, 11 Dec 2012 09:25:28 +0000 (11:25 +0200)
src/core/scripting.c

index f044538..c99b6c9 100644 (file)
@@ -243,7 +243,6 @@ mrp_context_tbl_t *mrp_create_context_table(void)
     mrp_htbl_config_t  hcfg;
 
     tbl = mrp_allocz(sizeof(*tbl));
-    tbl->frame = NULL;
 
     if (tbl != NULL) {
         mrp_clear(&hcfg);
@@ -251,6 +250,7 @@ mrp_context_tbl_t *mrp_create_context_table(void)
         hcfg.hash = mrp_string_hash;
         hcfg.free = NULL;
 
+        tbl->frame = NULL;
         tbl->names = mrp_htbl_create(&hcfg);
 
         if (tbl->names != NULL)