From b04b8b5610f23cd50c9a7a00eeca81229acd36d5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 16 Sep 2010 20:12:20 +1000 Subject: wbclient: gr_mem can be NULL if the structure was partly created and an error occurred, then don't crash Pair-Programmed-With: Andrew Bartlett --- nsswitch/libwbclient/wbc_pwd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nsswitch/libwbclient/wbc_pwd.c b/nsswitch/libwbclient/wbc_pwd.c index c7bfdb8fd8..1527808d88 100644 --- a/nsswitch/libwbclient/wbc_pwd.c +++ b/nsswitch/libwbclient/wbc_pwd.c @@ -100,6 +100,11 @@ static void wbcGroupDestructor(void *ptr) free(gr->gr_name); free(gr->gr_passwd); + /* if the array was partly created this can be NULL */ + if (gr->gr_mem == NULL) { + return; + } + for (i=0; gr->gr_mem[i] != NULL; i++) { free(gr->gr_mem[i]); } -- cgit