From 631fa3b4f3c025eb21557cf668071d91be9a43fe Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Tue, 1 Jan 2008 20:47:31 +0000 Subject: [PATCH] (split_groups): Test the pointer returned by malloc. --- ChangeLog | 4 ++++ lib/groupio.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 07696454..bc0e673d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-01-01 Nicolas François + + * lib/groupio.c (split_groups): Test the pointer returned by malloc. + 2008-01-01 Nicolas François * lib/commonio.c: Document add_one_entry_nis(), write_all(), diff --git a/lib/groupio.c b/lib/groupio.c index 1881a594..a519bc80 100644 --- a/lib/groupio.c +++ b/lib/groupio.c @@ -332,6 +332,10 @@ static int split_groups (unsigned int max_members) continue; new = (struct commonio_entry *) malloc (sizeof *new); + if (NULL == new) { + errno = ENOMEM; + return 0; + } new->eptr = group_dup(gr->eptr); if (NULL == new->eptr) { errno = ENOMEM;