From 7d2f90122754a2b0ef21671d68a9fa98fbe8d4a8 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 10 Jun 2010 11:16:16 +0200 Subject: Potential memory leak in _nss_sss_*_r() Fixes: #516 --- src/sss_client/group.c | 3 +++ src/sss_client/passwd.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src/sss_client') diff --git a/src/sss_client/group.c b/src/sss_client/group.c index e1b36e2a..60b4611c 100644 --- a/src/sss_client/group.c +++ b/src/sss_client/group.c @@ -235,6 +235,7 @@ enum nss_status _nss_sss_initgroups_dyn(const char *user, gid_t group, *start += 1; } + free(repbuf); return NSS_STATUS_SUCCESS; } @@ -274,6 +275,7 @@ enum nss_status _nss_sss_getgrnam_r(const char *name, struct group *result, /* only 1 result is accepted for this function */ if (((uint32_t *)repbuf)[0] != 1) { *errnop = EBADMSG; + free(repbuf); return NSS_STATUS_TRYAGAIN; } @@ -325,6 +327,7 @@ enum nss_status _nss_sss_getgrgid_r(gid_t gid, struct group *result, /* only 1 result is accepted for this function */ if (((uint32_t *)repbuf)[0] != 1) { *errnop = EBADMSG; + free(repbuf); return NSS_STATUS_TRYAGAIN; } diff --git a/src/sss_client/passwd.c b/src/sss_client/passwd.c index aa5c7602..95c7de61 100644 --- a/src/sss_client/passwd.c +++ b/src/sss_client/passwd.c @@ -208,6 +208,7 @@ enum nss_status _nss_sss_getpwnam_r(const char *name, struct passwd *result, /* only 1 result is accepted for this function */ if (((uint32_t *)repbuf)[0] != 1) { *errnop = EBADMSG; + free(repbuf); return NSS_STATUS_TRYAGAIN; } @@ -259,6 +260,7 @@ enum nss_status _nss_sss_getpwuid_r(uid_t uid, struct passwd *result, /* only 1 result is accepted for this function */ if (((uint32_t *)repbuf)[0] != 1) { *errnop = EBADMSG; + free(repbuf); return NSS_STATUS_TRYAGAIN; } -- cgit