From 175aa92e9e2fa4aa9d0c2fc9d7001ce4fae61a14 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 Aug 2006 20:15:31 +0000 Subject: r17446: Fix some C++ warnings and two memleaks found by Coverity, IDs 304 and 305. Volker (This used to be commit 4f6605a4880f54f2c7d1f3c7554408d893bc623c) --- source3/utils/ntlm_auth.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index c33ab9f8ac..f53b226fbb 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -676,10 +676,13 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod return; } else if (strncmp(buf, "GK", 2) == 0) { DEBUG(10, ("Requested NTLMSSP session key\n")); - if(have_session_key) - x_fprintf(x_stdout, "GK %s\n", base64_encode_data_blob(session_key)); - else + if(have_session_key) { + char *key64 = base64_encode_data_blob(session_key); + x_fprintf(x_stdout, "GK %s\n", key64?key64:""); + SAFE_FREE(key64); + } else { x_fprintf(x_stdout, "BH\n"); + } data_blob_free(&request); return; @@ -803,7 +806,9 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo DEBUG(10, ("Requested session key\n")); if(have_session_key) { - x_fprintf(x_stdout, "GK %s\n", base64_encode_data_blob(session_key)); + char *key64 = base64_encode_data_blob(session_key); + x_fprintf(x_stdout, "GK %s\n", key64?key64:""); + SAFE_FREE(key64); } else { x_fprintf(x_stdout, "BH\n"); @@ -873,7 +878,7 @@ static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode, char *user, *pass; user=buf; - pass=memchr(buf,' ',length); + pass=(char *)memchr(buf,' ',length); if (!pass) { DEBUG(2, ("Password not found. Denying access\n")); x_fprintf(x_stdout, "ERR\n"); @@ -1318,7 +1323,8 @@ static BOOL manage_client_krb5_init(SPNEGO_DATA spnego) return False; } - principal = SMB_MALLOC(spnego.negTokenInit.mechListMIC.length+1); + principal = (char *)SMB_MALLOC( + spnego.negTokenInit.mechListMIC.length+1); if (principal == NULL) { DEBUG(1, ("Could not malloc principal\n")); @@ -1963,7 +1969,7 @@ static void manage_squid_request(enum stdio_helper_mode helper_mode, stdio_helpe exit(0); } - c=memchr(buf,'\n',sizeof(buf)-1); + c=(char *)memchr(buf,'\n',sizeof(buf)-1); if (c) { *c = '\0'; length = c-buf; -- cgit