]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: properly check return code of add_to_partitions_array() [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 15 May 2019 14:49:26 +0000 (16:49 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 15 May 2019 14:49:26 +0000 (16:49 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/context.c

index 1e0e346a1b20187ffd01bf5d6ae3e094dbc44b08..9de57ac6ac49515dcc08a5b9b2b66b24796dd008 100644 (file)
@@ -846,7 +846,8 @@ int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org)
                        break;
                case FDISK_DIFF_MOVED:
                        rc = add_to_partitions_array(&rem, pa, &nrems, nparts);
-                       rc = add_to_partitions_array(&add, pa, &nadds, nparts);
+                       if (!rc)
+                               rc = add_to_partitions_array(&add, pa, &nadds, nparts);
                        break;
                }
                if (rc != 0)