diff options
| author | Ritika Chopra <r.chopra@vyos.io> | 2026-01-06 10:13:14 -0700 |
|---|---|---|
| committer | Ritika Chopra <r.chopra@vyos.io> | 2026-01-06 10:13:14 -0700 |
| commit | 3a5c91e6fc4ba64d5e922a7f3b5d1b5ed38ba3f7 (patch) | |
| tree | 2698c9b8f97e42bf8b956739cc103f6f690f1d83 | |
| parent | 9a57723bb67d9a9b8b27f42262e10b2b03658b35 (diff) | |
| download | libnss-tacplus-3a5c91e6fc4ba64d5e922a7f3b5d1b5ed38ba3f7.tar.gz libnss-tacplus-3a5c91e6fc4ba64d5e922a7f3b5d1b5ed38ba3f7.zip | |
T8083: Address memory leaks in the related code leg
| -rw-r--r-- | nss_tacplus.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nss_tacplus.c b/nss_tacplus.c index 5492611..e717610 100644 --- a/nss_tacplus.c +++ b/nss_tacplus.c @@ -1026,6 +1026,8 @@ fixup_gr_mem(const char *grnam, const char **gr_in, char *buf, total_chars += (long long)strlen(tok) + 1; tok = strtok_r(NULL, ",", &saved); } + free(mapnames); + mapnames = NULL; } else { nadded++; @@ -1056,11 +1058,16 @@ fixup_gr_mem(const char *grnam, const char **gr_in, char *buf, tok = strtok_r(mapnames, ",", &saved); while (tok) { gr_mem[midx] = mem; - if(copyuser(&mem, tok, &len, err)) + if(copyuser(&mem, tok, &len, err)) { + free(mapnames); + mapnames = NULL; goto done; + } midx++; tok = strtok_r(NULL, ",", &saved); } + free(mapnames); + mapnames = NULL; } else { /* just copy what was returned to the buffer */ gr_mem[midx] = mem; |
