Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen Remove redundant null check before free. it is ...
details: https://anonhg.NetBSD.org/src/rev/692c17d388cb
branches: trunk
changeset: 351997:692c17d388cb
user: maya <maya%NetBSD.org@localhost>
date: Thu Mar 09 11:39:41 2017 +0000
description:
Remove redundant null check before free. it is safe to free(NULL)
While here, clear up odd whitespace issue. NFC
diffstat:
lib/libc/gen/extattr.c | 36 ++++++++++++++----------------------
1 files changed, 14 insertions(+), 22 deletions(-)
diffs (85 lines):
diff -r 3edca2d5ba37 -r 692c17d388cb lib/libc/gen/extattr.c
--- a/lib/libc/gen/extattr.c Thu Mar 09 10:10:02 2017 +0000
+++ b/lib/libc/gen/extattr.c Thu Mar 09 11:39:41 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extattr.c,v 1.4 2012/03/13 21:13:34 christos Exp $ */
+/* $NetBSD: extattr.c,v 1.5 2017/03/09 11:39:41 maya Exp $ */
/*-
* Copyright (c) 2001 Robert N. M. Watson
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: extattr.c,v 1.4 2012/03/13 21:13:34 christos Exp $");
+__RCSID("$NetBSD: extattr.c,v 1.5 2017/03/09 11:39:41 maya Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -150,7 +150,7 @@
}
if ((vlen = extattr_get_fd(from_fd, namespace, aname,
- aval, (size_t)vlen)) == -1)
+ aval, (size_t)vlen)) == -1)
goto out;
if (extattr_set_fd(to_fd, namespace, aname,
@@ -160,12 +160,9 @@
error = 0;
out:
- if (aval != NULL)
- free(aval);
-
- if (alist != NULL)
- free(alist);
-
+ free(aval);
+ free(alist);
+
return error;
}
@@ -222,7 +219,8 @@
maxvlen = vlen;
}
- if ((vlen = extattr_get_file(from, namespace, aname, aval, (size_t)vlen)) == -1)
+ if ((vlen = extattr_get_file(from, namespace, aname,
+ aval, (size_t)vlen)) == -1)
goto out;
if (extattr_set_file(to, namespace, aname,
@@ -232,12 +230,9 @@
error = 0;
out:
- if (aval != NULL)
- free(aval);
-
- if (alist != NULL)
- free(alist);
-
+ free(aval);
+ free(alist);
+
return error;
}
@@ -305,12 +300,9 @@
error = 0;
out:
- if (aval != NULL)
- free(aval);
-
- if (alist != NULL)
- free(alist);
-
+ free(aval);
+ free(alist);
+
return error;
}
Home |
Main Index |
Thread Index |
Old Index