summaryrefslogtreecommitdiffstats
path: root/include/xalloc.h
diff options
context:
space:
mode:
authorKarel Zak2019-07-15 11:37:17 +0200
committerKarel Zak2019-07-15 11:37:17 +0200
commit6744302ce5b23ef19d7cfaa20cb53d27642ea8ac (patch)
treecf0b984c0ecc6b52e39caf2e39d7f4cc6f9b252a /include/xalloc.h
parentbuild-sys: Include <stdlib.h> in ./configure wchar_t test (diff)
parentlibblkid: fix address sanitizer issues (diff)
downloadkernel-qcow2-util-linux-6744302ce5b23ef19d7cfaa20cb53d27642ea8ac.tar.gz
kernel-qcow2-util-linux-6744302ce5b23ef19d7cfaa20cb53d27642ea8ac.tar.xz
kernel-qcow2-util-linux-6744302ce5b23ef19d7cfaa20cb53d27642ea8ac.zip
Merge branch '2019wk27' of https://github.com/kerolasa/util-linux
* '2019wk27' of https://github.com/kerolasa/util-linux: libblkid: fix address sanitizer issues libblkid: check number of test_blkid_save arguments correctly include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute libmount: fix potential null pointer dereference libfdisk: fix variable shadowing lib/ttyutils: avoid checking same thing twice
Diffstat (limited to 'include/xalloc.h')
-rw-r--r--include/xalloc.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/xalloc.h b/include/xalloc.h
index 0129a85e2..48712a452 100644
--- a/include/xalloc.h
+++ b/include/xalloc.h
@@ -62,8 +62,7 @@ static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull
{
char *ret;
- if (!str)
- return NULL;
+ assert(str);
ret = strdup(str);
@@ -77,8 +76,7 @@ xstrndup(const char *str, size_t size)
{
char *ret;
- if (!str)
- return NULL;
+ assert(str);
ret = strndup(str, size);