block: Checking calloc failed 34/148434/2 accepted/tizen/4.0/unified/20170908.222309 submit/tizen_4.0/20170908.052712
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 03:25:36 +0000 (12:25 +0900)
Change-Id: Icad2dd4c3580793d4ce6838210b62df00d7a3c08
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/core/modules.c

index d4d6e8f..ca303ea 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);