]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic: check strdup result in khash_dup (#5176)
authorEvgeny Vereshchagin <evvers@ya.ru>
Tue, 31 Jan 2017 07:27:14 +0000 (10:27 +0300)
committerMartin Pitt <martinpitt@users.noreply.github.com>
Tue, 31 Jan 2017 07:27:14 +0000 (08:27 +0100)
Fixes CID #1368249

src/basic/khash.c

index 9a2a3edb750e8069533c0d55392ca0d3fc80c50c..84648dc1c9463debfeca1e1d8cff9e1e3f9ff4be 100644 (file)
@@ -143,7 +143,7 @@ int khash_dup(khash *h, khash **ret) {
 
         copy->fd = -1;
         copy->algorithm = strdup(h->algorithm);
-        if (!copy)
+        if (!copy->algorithm)
                 return -ENOMEM;
 
         copy->fd = accept4(h->fd, NULL, 0, SOCK_CLOEXEC);