[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Tue Aug 14 09:11:41 UTC 2007


 libparted/arch/linux.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit c510c225cd815873e5489d3e0702d5b1d6124125
Author: Jim Meyering <jim at meyering.net>
Date:   Mon Aug 13 22:41:39 2007 +0200

    Don't try to avoid "free (x)" when x is NULL.
    
    * 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 at meyering.net>

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index f1f6aaa..648bd2b 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1530,8 +1530,7 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
                 }
         }
 
-        if (diobuf)
-                free(diobuf);
+        free (diobuf);
 
         return 1;
 }



More information about the Parted-commits mailing list