[asterisk-commits] markster: branch markster/usersconf r39511 - /team/markster/usersconf/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Aug 11 04:28:15 MST 2006


Author: markster
Date: Fri Aug 11 06:28:14 2006
New Revision: 39511

URL: http://svn.digium.com/view/asterisk?rev=39511&view=rev
Log:
Handle users properly (i.e. fix segfault)

Modified:
    team/markster/usersconf/channels/chan_iax2.c

Modified: team/markster/usersconf/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/markster/usersconf/channels/chan_iax2.c?rev=39511&r1=39510&r2=39511&view=diff
==============================================================================
--- team/markster/usersconf/channels/chan_iax2.c (original)
+++ team/markster/usersconf/channels/chan_iax2.c Fri Aug 11 06:28:14 2006
@@ -8468,7 +8468,7 @@
 		}
 	} else
 		user = NULL;
-	
+
 	if (user) {
 		if (firstpass) {
 			oldcurauthreq = user->curauthreq;
@@ -8484,15 +8484,16 @@
 		AST_LIST_UNLOCK(&users);
 		/* This is going to memset'd to 0 in the next block */
 		user = ast_calloc(sizeof(*user),1);
-		if (ast_string_field_init(user, 32)) {
-			free(user);
-			user = NULL;
-		}
 	}
 	
 	if (user) {
 		if (firstpass) {
+			ast_string_field_free_all(user);
 			memset(user, 0, sizeof(struct iax2_user));
+			if (ast_string_field_init(user, 32)) {
+				free(user);
+				user = NULL;
+			}
 			user->maxauthreq = maxauthreq;
 			user->curauthreq = oldcurauthreq;
 			user->prefs = prefs;



More information about the asterisk-commits mailing list