From 9cd920aa6d71b41bc280df87efeec1a1182bc03f Mon Sep 17 00:00:00 2001 From: lijian Date: Wed, 24 Jun 2026 11:26:41 +0200 Subject: [PATCH] fdisk: clean up dead code in resize_partition() 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 Signed-off-by: Karel Zak --- disk-utils/fdisk.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 1fc112c05..30481544a 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -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: -- 2.47.3