]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: clean up dead code in resize_partition()
authorlijian <lijian01@kylinos.cn>
Wed, 24 Jun 2026 09:26:41 +0000 (11:26 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 24 Jun 2026 09:27:29 +0000 (11:27 +0200)
Remove unused variables 'pa', 'next', 'tb' and their corresponding
fdisk_unref_partition()/fdisk_unref_table() calls in the cleanup
path -- all three are initialized to NULL and never reassigned.

[kzak@redhat.com: - fix identification, remove also 'tb']

Signed-off-by: lijian <lijian01@kylinos.cn>
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.c

index 1fc112c05757fa61384da80d180e43f2297b82c1..30481544a6cf2a5245d91c0787b799d3193fbfa9 100644 (file)
@@ -679,9 +679,8 @@ static int strtosize_sectors(const char *str, unsigned long sector_size,
 
 void resize_partition(struct fdisk_context *cxt)
 {
-       struct fdisk_partition *pa = NULL, *npa = NULL, *next = NULL;
+       struct fdisk_partition *npa = NULL;
        char *query = NULL, *response = NULL, *default_size;
-       struct fdisk_table *tb = NULL;
        uint64_t max_size, secs;
        uintmax_t size;
        size_t i = 0;
@@ -732,10 +731,7 @@ void resize_partition(struct fdisk_context *cxt)
 out:
        free(query);
        free(response);
-       fdisk_unref_partition(next);
-       fdisk_unref_partition(pa);
        fdisk_unref_partition(npa);
-       fdisk_unref_table(tb);
        return;
 
 err: