From a711dd4ba8f2c71a260a3f7539c0e86175f97a21 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 21 Apr 2000 16:15:11 +0000 Subject: Update. 2000-04-21 Ulrich Drepper * iconv/iconv.c (iconv): Add __builtin_expect where useful. * iconv/iconv_close.c (iconv_close): Likewise. * iconv/iconv_open.c (iconv_open): Likewise. * grp/putgrent.c (putgrent): Unlock steam if fprintf failed. Add __builtin_expect where useful. * grp/initgroups.c (initgroups): Test for result of memory allocation and punt if it fails. * dirent/scandir.c (scandir): Add __builtin_expect where useful. * grp/fgetgrent.c (fgetfrent): Likewise. * grp/fgetgrent_r.c (__fgetgrent_r): Likewise. --- grp/initgroups.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'grp/initgroups.c') diff --git a/grp/initgroups.c b/grp/initgroups.c index fd30ebf7e0..06c48bb040 100644 --- a/grp/initgroups.c +++ b/grp/initgroups.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1989, 91, 93, 96, 97, 98, 99 Free Software Foundation, Inc. +/* Copyright (C) 1989, 91, 93, 1996-1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -163,7 +163,10 @@ initgroups (user, group) size = 16; #endif - groups = malloc (size * sizeof (gid_t *)); + groups = (gid_t *) malloc (size * sizeof (gid_t)); + if (__builtin_expect (groups == NULL, 0)) + /* No more memory. */ + return -1; groups[0] = group; -- cgit v1.2.3