common: fix 'FORWARD_NULL' issue 80/49280/1
authorSuchang Woo <suchang.woo@samsung.com>
Mon, 12 Oct 2015 08:13:02 +0000 (17:13 +0900)
committerSuchang Woo <suchang.woo@samsung.com>
Mon, 12 Oct 2015 08:14:34 +0000 (17:14 +0900)
If mod is NULL, it makes segfault issue.

Change-Id: Iac10ab796bcf6e3dfcfb29d6f1babeed72d98a14
Signed-off-by: Suchang Woo <suchang.woo@samsung.com>
common/backends.c

index fbeaf53..e5ee17c 100644 (file)
@@ -64,8 +64,10 @@ const struct backend *backend_get(const char *name)
        }
 
        mod = g_hash_table_lookup(backends, name);
-       if (!mod)
+       if (!mod) {
                errno = ENOENT;
+               return NULL;
+       }
 
        return mod->backend;
 }