Don't test for NULL before calling free(3)
free(3) accepts NULL, since the oldest ISO C. I guess the paranoid code was taking care of prehistoric implementations of free(3). I've never known of an implementation that doesn't conform to this, so let's simplify this. Remove xfree(3), which was effectively an equivalent of free(3). Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
1 parent
1b0e189e35
commit
0d9799de04
11 files changed
+18
-58
No files matched your search
+2
-6
@@ -354,12 +354,8 @@ static int copy_tree_impl (const struct path_info *src, const struct path_info *
|
||||
old_uid, new_uid,
|
||||
old_gid, new_gid);
|
||||
}
|
||||
if (NULL != src_name) {
|
||||
free (src_name);
|
||||
}
|
||||
if (NULL != dst_name) {
|
||||
free (dst_name);
|
||||
}
|
||||
free (src_name);
|
||||
free (dst_name);
|
||||
}
|
||||
}
|
||||
(void) closedir (dir);
|
||||
|
||||
@@ -44,10 +44,3 @@
|
||||
{
|
||||
return strcpy (xmalloc (strlen (str) + 1), str);
|
||||
}
|
||||
|
||||
void xfree(void *ap)
|
||||
{
|
||||
if (ap) {
|
||||
free(ap);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user