OSDN Git Service

Don't try to avoid "free (x)" when x is NULL.
authorJim Meyering <jim@meyering.net>
Mon, 13 Aug 2007 20:41:39 +0000 (22:41 +0200)
committerJim Meyering <jim@meyering.net>
Tue, 14 Aug 2007 09:11:21 +0000 (11:11 +0200)
* libparted/arch/linux.c (linux_read):
Part of http://git.debian.org/?p=parted/parted.git;a=commitdiff;h=080d3e7078
changed this:

  free(diobuf);

to this:

  if (diobuf)
      free(diobuf);

Yet, free doesn't have any problem with NULL.
Some very old (non-POSIX) implementations did (like SunOS4),
but even for them, gnulib's lib/free.c protects us.

Signed-off-by: Jim Meyering <jim@meyering.net>
libparted/arch/linux.c

index f1f6aaa..648bd2b 100644 (file)
@@ -1530,8 +1530,7 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                 }
         }
 
-        if (diobuf)
-                free(diobuf);
+        free (diobuf);
 
         return 1;
 }