[parted-devel] [PATCH] Don't try to avoid "free (x)" when x is NULL.
Jim Meyering
jim at meyering.net
Tue Aug 14 09:12:48 UTC 2007
FYI, I've just pushed this:
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>
---
libparted/arch/linux.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
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;
}
--
1.5.3.rc4.67.gf9286
More information about the parted-devel
mailing list