summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2017-10-18 18:09:05 +0200
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-08-20 16:42:33 -0700
commit0124a9ea65118ae70bcc155e2a9a36a6c4869310 (patch)
treeaa1990a1a22c3253d3d9a2cf2e642d6f2a3a9127
parent1e7787324a788fe84f7e438f4db9a47c8f6dd952 (diff)
make sure buffer is zero filled and report if allocation failed
Signed-off-by: Walter Harms <wharms@bfs.de> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/listenwk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/listenwk.c b/src/listenwk.c
index 8452e04..6d0f4d6 100644
--- a/src/listenwk.c
+++ b/src/listenwk.c
@@ -68,11 +68,14 @@ IceListenForWellKnownConnections (
return (0);
}
- if ((listenObjs = malloc (transCount * sizeof (struct _IceListenObj))) == NULL)
+ listenObjs = calloc (transCount, sizeof (struct _IceListenObj));
+ if (listenObjs == NULL)
{
for (i = 0; i < transCount; i++)
_IceTransClose (transConns[i]);
free (transConns);
+
+ strncpy (errorStringRet, "Malloc failed", errorLength);
return (0);
}