From: David Tardon Date: Fri, 12 Oct 2018 12:48:41 +0000 (+0200) Subject: do not try to allocate 0 bytes X-Git-Tag: v240~563^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8192548ef792c7aa3202a27e060a2c4994f399f3;p=thirdparty%2Fsystemd.git do not try to allocate 0 bytes --- diff --git a/src/shared/fdset.c b/src/shared/fdset.c index 8c852f11372..5d277328c72 100644 --- a/src/shared/fdset.c +++ b/src/shared/fdset.c @@ -211,13 +211,16 @@ fail: int fdset_close_others(FDSet *fds) { void *e; Iterator i; - int *a; + int *a = NULL; size_t j = 0, m; m = fdset_size(fds); - a = newa(int, m); - SET_FOREACH(e, MAKE_SET(fds), i) - a[j++] = PTR_TO_FD(e); + + if (m > 0) { + a = newa(int, m); + SET_FOREACH(e, MAKE_SET(fds), i) + a[j++] = PTR_TO_FD(e); + } assert(j == m);