core: don't use memory if allocation failed.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Tue, 11 Feb 2014 12:12:44 +0000 (14:12 +0200)
committerIsmo Puustinen <ismo.puustinen@intel.com>
Tue, 11 Feb 2014 12:12:44 +0000 (14:12 +0200)
src/core/lua-utils/funcbridge.c

index a5df175..b81fe6b 100644 (file)
@@ -538,8 +538,10 @@ mrp_funcarray_t *mrp_funcarray_check(lua_State *L, int t)
         fa = mrp_funcarray_create(L);
 
         fa->funcs = calloc(1, sizeof(mrp_funcbridge_t *));
-        fa->nfunc = 1;
+        if (!fa->funcs)
+            return NULL;
 
+        fa->nfunc = 1;
         fa->funcs[0] = mrp_funcbridge_create_luafunc(L, t);
 
         break;