summaryrefslogtreecommitdiff
path: root/AuFileName.c
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-02 01:07:41 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2014-01-02 01:07:41 -0800
commit1e4635be11154dd8262f37b379511bd627defa2a (patch)
tree8326c85cd5315f334bb28a9e6170244d4a97064d /AuFileName.c
parent304a11be4727c5a7feeb2501e8e001466f8ce84e (diff)
Silence a benign static analysis warning with an assert of allocation size
AuFileName.c:72:8: warning: Call to 'malloc' has an allocation size of 0 bytes buf = malloc (size); ^~~~~~~~~~~~~ Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Diffstat (limited to 'AuFileName.c')
-rw-r--r--AuFileName.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/AuFileName.c b/AuFileName.c
index 7cedfcc..37c8b62 100644
--- a/AuFileName.c
+++ b/AuFileName.c
@@ -29,6 +29,7 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <X11/Xauth.h>
#include <X11/Xos.h>
+#include <assert.h>
#include <stdlib.h>
static char *buf = NULL;
@@ -69,6 +70,7 @@ XauFileName (void)
if ((size > bsize) || (buf == NULL)) {
if (buf)
free (buf);
+ assert(size > 0);
buf = malloc (size);
if (!buf) {
bsize = 0;