You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2020/12/21 15:40:32 UTC

[qpid-dispatch] 02/02: fixup, calloc is allowed to return NULL if nmemb or size is zero

This is an automated email from the ASF dual-hosted git repository.

tross pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git

commit 0634a070aa6f902bf5b6f9537a5406e4cfc5a0d5
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Mon Dec 21 15:58:50 2020 +0100

    fixup, calloc is allowed to return NULL if nmemb or size is zero
---
 include/qpid/dispatch/ctools.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/qpid/dispatch/ctools.h b/include/qpid/dispatch/ctools.h
index d071ffc..3dbb39d 100644
--- a/include/qpid/dispatch/ctools.h
+++ b/include/qpid/dispatch/ctools.h
@@ -237,7 +237,7 @@ static inline void *qd_malloc(size_t size)
 static inline void *qd_calloc(size_t nmemb, size_t size)
 {
     void *ptr = calloc(nmemb, size);
-    if (!ptr) {
+    if (!ptr && nmemb && size) {
         perror("qd_calloc");
         abort();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org