core: minor error handling fix in mount_setup_new_unit()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Jan 2017 00:45:58 +0000 (09:45 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 23 Jan 2017 04:59:21 +0000 (13:59 +0900)
The function mount_setup_new_unit() should return -ENOMEM
if at least one of `strdup` calls are failed.

src/core/mount.c

index 8192a36..fb08022 100644 (file)
@@ -1408,7 +1408,7 @@ static int mount_setup_new_unit(
 
         u->source_path = strdup("/proc/self/mountinfo");
         MOUNT(u)->where = strdup(where);
-        if (!u->source_path && !MOUNT(u)->where)
+        if (!u->source_path || !MOUNT(u)->where)
                 return -ENOMEM;
 
         /* Make sure to initialize those fields before mount_is_extrinsic(). */