File pdisk-write_partition_map-unused-result.patch of Package pdisk

 partition_map.c: In function 'write_partition_map':
 partition_map.c:323: warning: 'result' may be used uninitialized in this function

 partition_map.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

Index: pdisk/partition_map.c
===================================================================
--- pdisk.orig/partition_map.c
+++ pdisk/partition_map.c
@@ -317,7 +317,7 @@ void
 write_partition_map(partition_map_header *map)
 {
     MEDIA m;
-    char *block;
+    char block[PBLOCK_SIZE];
     partition_map * entry;
     int i = 0;
     int result;
@@ -328,11 +328,8 @@ write_partition_map(partition_map_header
 	result = write_block(map, 0, (char *)map->misc);
 	convert_block0(map->misc, 1);
     } else {
-	block = (char *) calloc(1, PBLOCK_SIZE);
-	if (block != NULL) {
-	    result = write_block(map, 0, block);
-	    free(block);
-	}
+	memset(block,0,sizeof(block));
+	result = write_block(map, 0, block);
     }
     if (result == 0) {
 	error(errno, "Unable to write block zero");
@@ -349,13 +346,9 @@ write_partition_map(partition_map_header
 	// zap the block after the map (if possible) to get around a bug.
     if (map->maximum_in_map > 0 &&  i < map->maximum_in_map) {
 	i += 1;
-	block = (char *) malloc(PBLOCK_SIZE);
-	if (block != NULL) {
-	    if (read_block(map, i, block)) {
+	if (read_block(map, i, block)) {
 		block[0] = 0;
 		write_block(map, i, block);
-	    }
-	    free(block);
 	}
     }
     if (interactive)
openSUSE Build Service is sponsored by