svn commit: samba r19710 - in branches: SAMBA_3_0/source/nsswitch SAMBA_3_0_23/source/nsswitch SAMBA_3_0_24/source/nsswitch

jra at samba.org jra at samba.org
Wed Nov 15 02:06:59 GMT 2006


Author: jra
Date: 2006-11-15 02:06:58 +0000 (Wed, 15 Nov 2006)
New Revision: 19710

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19710

Log:
Fix memory leak in get_conf_item_string(). As
we're just doing strchr on a const string there's
no need to strdup it before, we're never modifying
it. Just remove the variable "parm".
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
   branches/SAMBA_3_0_23/source/nsswitch/pam_winbind.c
   branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/pam_winbind.c	2006-11-15 01:06:45 UTC (rev 19709)
+++ branches/SAMBA_3_0/source/nsswitch/pam_winbind.c	2006-11-15 02:06:58 UTC (rev 19710)
@@ -901,7 +901,6 @@
 				 int config_flag)
 {
 	int i = 0;
-	char *parm = NULL;
 	const char *parm_opt = NULL;
 	char *key = NULL;
 
@@ -926,9 +925,7 @@
 		if ((strncmp(argv[i], item, strlen(item)) == 0)) {
 			char *p;
 
-			parm = strdup(argv[i]);
-
-			if ( (p = strchr( parm, '=' )) == NULL) {
+			if ( (p = strchr( argv[i], '=' )) == NULL) {
 				_pam_log(pamh, ctrl, LOG_INFO, "no \"=\" delimiter for \"%s\" found\n", item);
 				goto out;
 			}
@@ -941,7 +938,6 @@
 		_pam_log_debug(pamh, ctrl, LOG_INFO, "CONFIG file: %s '%s'\n", item, parm_opt);
 	}
 out:
-	SAFE_FREE(parm);
 	return parm_opt;
 }
 

Modified: branches/SAMBA_3_0_23/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0_23/source/nsswitch/pam_winbind.c	2006-11-15 01:06:45 UTC (rev 19709)
+++ branches/SAMBA_3_0_23/source/nsswitch/pam_winbind.c	2006-11-15 02:06:58 UTC (rev 19710)
@@ -830,7 +830,6 @@
 				 int flag)
 {
 	int i = 0;
-	char *parm = NULL;
 	const char *parm_opt = NULL;
 	char *key = NULL;
 
@@ -855,9 +854,7 @@
 		if ((strncmp(argv[i], item, strlen(item)) == 0)) {
 			char *p;
 
-			parm = strdup(argv[i]);
-
-			if ( (p = strchr( parm, '=' )) == NULL) {
+			if ( (p = strchr( argv[i], '=' )) == NULL) {
 				_pam_log(LOG_INFO, "no \"=\" delimiter for \"%s\" found\n", item);
 				goto out;
 			}
@@ -870,7 +867,6 @@
 		_pam_log_debug(ctrl, LOG_INFO, "CONFIG file: %s '%s'\n", item, parm_opt);
 	}
 out:
-	SAFE_FREE(parm);
 	return parm_opt;
 }
 

Modified: branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c
===================================================================
--- branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c	2006-11-15 01:06:45 UTC (rev 19709)
+++ branches/SAMBA_3_0_24/source/nsswitch/pam_winbind.c	2006-11-15 02:06:58 UTC (rev 19710)
@@ -901,7 +901,6 @@
 				 int config_flag)
 {
 	int i = 0;
-	char *parm = NULL;
 	const char *parm_opt = NULL;
 	char *key = NULL;
 
@@ -926,9 +925,7 @@
 		if ((strncmp(argv[i], item, strlen(item)) == 0)) {
 			char *p;
 
-			parm = strdup(argv[i]);
-
-			if ( (p = strchr( parm, '=' )) == NULL) {
+			if ( (p = strchr( argv[i], '=' )) == NULL) {
 				_pam_log(pamh, ctrl, LOG_INFO, "no \"=\" delimiter for \"%s\" found\n", item);
 				goto out;
 			}
@@ -941,7 +938,6 @@
 		_pam_log_debug(pamh, ctrl, LOG_INFO, "CONFIG file: %s '%s'\n", item, parm_opt);
 	}
 out:
-	SAFE_FREE(parm);
 	return parm_opt;
 }
 



More information about the samba-cvs mailing list