nsswitch/winbind_nss_aix.c(fill_grent): fixed memory leak.
authorSlava Semushin <php-coder@altlinux.ru>
Sat, 23 May 2009 14:02:40 +0000 (21:02 +0700)
committerVolker Lendecke <vl@samba.org>
Mon, 25 May 2009 14:14:16 +0000 (16:14 +0200)
Found by cppcheck:
[./nsswitch/winbind_nss_aix.c:241]: (error) Memory leak: result

nsswitch/winbind_nss_aix.c

index 17578cf3501ad2b79206e0003a52f41748338dc1..66200f35629808278aad9762086bd1ed599f96f8 100644 (file)
@@ -237,6 +237,9 @@ static struct group *fill_grent(struct winbindd_gr *gr, char *gr_mem)
 
        result->gr_mem = (char **)malloc(sizeof(char *) * (gr->num_gr_mem+1));
        if (!result->gr_mem) {
+               free(result->gr_name);
+               free(result->gr_passwd);
+               free(result);
                errno = ENOMEM;
                return NULL;
        }