fix use string after null check 77/222177/1 accepted/tizen/unified/20200113.130531 submit/tizen/20200113.015142
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 10 Jan 2020 06:29:42 +0000 (15:29 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 10 Jan 2020 06:29:47 +0000 (15:29 +0900)
The result of strdup() can be null, so use it after null check.

Change-Id: I61b5e5a4d4b631984eb19240b46afe0e94752043
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
src/main.c

index 194e2c8..80267db 100644 (file)
@@ -39,7 +39,8 @@ int _main(int argc, char *argv[])
                                if (opt_table)
                                        free(opt_table);
                                opt_table = strdup(optarg);
-                               part_table = opt_table;
+                               if (opt_table)
+                                       part_table = opt_table;
                        } else {
                                fprintf(stderr,
                                        "path should be specified with '-i'\n");