block: Checking calloc failed 32/148432/3 accepted/tizen/unified/20170908.220714 submit/tizen/20170908.052651
authorpr.jung <pr.jung@samsung.com>
Fri, 8 Sep 2017 02:31:33 +0000 (11:31 +0900)
committerpr.jung <pr.jung@samsung.com>
Fri, 8 Sep 2017 05:21:24 +0000 (14:21 +0900)
Change-Id: Icad2dd4c3580793d4ce6838210b62df00d7a3c08
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/core/modules.c

index d4d6e8fe9b605d5fd444177aa5786b14027e838a..ca303ea1a8ee35f192ba4f9322a97f35faea302e 100644 (file)
@@ -135,6 +135,12 @@ int modules_init(void *data)
                _I("%s opened", path);
 
                module = calloc(1, sizeof(struct storaged_module));
+               if (!module) {
+                       _E("Failed to allocate memory");
+                       if (dp)
+                               closedir(dp);
+                       return -ENOMEM;
+               }
                module->plugin = plugin;
                module->name = strdup(plugin->name);
                module->so_name = strdup(dir->d_name);