The Samba-Bugzilla – Attachment 13990 Details for
Bug 13283
nsswitch: fix double free errors in nsstest.c
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.8 cherry-picked from master
bug13283-v48.patch (text/plain), 2.16 KB, created by
Ralph Böhme
on 2018-02-27 10:16:55 UTC
(
hide
)
Description:
Patch for 4.8 cherry-picked from master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2018-02-27 10:16:55 UTC
Size:
2.16 KB
patch
obsolete
>From 587ebfd021b62359298f6ebe46e12b3b6469b0bc Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Sat, 10 Feb 2018 23:54:33 +0100 >Subject: [PATCH] nsswitch: fix double free errors in nsstest.c > >We need to zero out static pointers on free. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=13283 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit da784305e7b306664b79d30a734d45582f5bf4dd) >--- > nsswitch/nsstest.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > >diff --git a/nsswitch/nsstest.c b/nsswitch/nsstest.c >index 4b3d0a4301c..6d92806cffc 100644 >--- a/nsswitch/nsstest.c >+++ b/nsswitch/nsstest.c >@@ -21,6 +21,8 @@ > #include "replace.h" > #include "nsswitch/nsstest.h" > >+#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); (x)=NULL;} } while(0) >+ > static const char *so_path = "/lib/libnss_winbind.so"; > static const char *nss_name = "winbind"; > static int nss_errno; >@@ -48,10 +50,10 @@ static void *find_fn(const char *name) > if (!res) { > printf("Can't find function %s\n", s); > total_errors++; >- free(s); >+ SAFE_FREE(s); > return NULL; > } >- free(s); >+ SAFE_FREE(s); > return res; > } > >@@ -194,12 +196,12 @@ static struct group *nss_getgrent(void) > goto again; > } > if (status == NSS_STATUS_NOTFOUND) { >- free(buf); >+ SAFE_FREE(buf); > return NULL; > } > if (status != NSS_STATUS_SUCCESS) { > report_nss_error("getgrent", status); >- free(buf); >+ SAFE_FREE(buf); > return NULL; > } > return &grp; >@@ -232,12 +234,12 @@ static struct group *nss_getgrnam(const char *name) > goto again; > } > if (status == NSS_STATUS_NOTFOUND) { >- free(buf); >+ SAFE_FREE(buf); > return NULL; > } > if (status != NSS_STATUS_SUCCESS) { > report_nss_error("getgrnam", status); >- free(buf); >+ SAFE_FREE(buf); > return NULL; > } > return &grp; >@@ -271,12 +273,12 @@ static struct group *nss_getgrgid(gid_t gid) > goto again; > } > if (status == NSS_STATUS_NOTFOUND) { >- free(buf); >+ SAFE_FREE(buf); > return NULL; > } > if (status != NSS_STATUS_SUCCESS) { > report_nss_error("getgrgid", status); >- free(buf); >+ SAFE_FREE(buf); > return NULL; > } > return &grp; >-- >2.13.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 13283
: 13990