From 21a496d2e01f3721eac6df0d3e12a1c27409e44a Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Wed, 14 Oct 2009 12:27:39 -0700 Subject: [PATCH] Fix bug 6811 - pam_winbind references freed memory. s3: Fix reference to freed memory in pam_winbind. --- source/nsswitch/pam_winbind.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/nsswitch/pam_winbind.c b/source/nsswitch/pam_winbind.c index 4dcfe73..ffdec2e 100644 --- a/source/nsswitch/pam_winbind.c +++ b/source/nsswitch/pam_winbind.c @@ -977,6 +977,7 @@ static bool winbind_name_to_sid_string(struct pwb_context *ctx, int sid_list_buffer_size) { const char* sid_string; + char *sid_str; /* lookup name? */ if (IS_SID_STRING(name)) { @@ -985,7 +986,6 @@ static bool winbind_name_to_sid_string(struct pwb_context *ctx, wbcErr wbc_status; struct wbcDomainSid sid; enum wbcSidType type; - char *sid_str; _pam_log_debug(ctx, LOG_DEBUG, "no sid given, looking up: %s\n", name); @@ -1002,15 +1002,16 @@ static bool winbind_name_to_sid_string(struct pwb_context *ctx, return false; } - wbcFreeMemory(sid_str); sid_string = sid_str; } if (!safe_append_string(sid_list_buffer, sid_string, sid_list_buffer_size)) { + wbcFreeMemory(sid_str); return false; } + wbcFreeMemory(sid_str); return true; } -- 1.5.4.3