[asterisk-commits] murf: branch murf/bug11210 r102856 - /team/murf/bug11210/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 7 12:20:09 CST 2008


Author: murf
Date: Thu Feb  7 12:20:09 2008
New Revision: 102856

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102856
Log:
Another checkpoint. Found a set of places where the results of a find_user or find_peer call were not unref'd when the pointers went out of scope. Now, all the peers and users seem to be destroyed properly, but I found another dialog that isn't being freed... sigh.

Modified:
    team/murf/bug11210/channels/chan_sip.c

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=102856&r1=102855&r2=102856
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Thu Feb  7 12:20:09 2008
@@ -3931,7 +3931,6 @@
 		ast_set_flag(&user->flags[1], SIP_PAGE2_RTCACHEFRIENDS);
 		ast_atomic_fetchadd_int(&suserobjs, 1);
 		ao2_t_link(users, user, "link user into users table");
-	} else {
 		/* Move counter from s to r... */
 		ast_atomic_fetchadd_int(&suserobjs, -1);
 		ast_atomic_fetchadd_int(&ruserobjs, 1);
@@ -11217,7 +11216,7 @@
 		if (debug)
 			ast_verbose("Found user '%s' for '%s', but fails host access\n",
 				user->name, of);
-		unref_user(user, "unref_user: from check_auth_result from find_user call");
+		unref_user(user, "unref_user: from check_user_ok from find_user call, early return of AUTH_DONT_KNOW.");
 		return AUTH_DONT_KNOW;
 	}
 	if (debug)
@@ -18963,6 +18962,7 @@
 				struct sip_user *up = find_user(p->username, 1);
 				if (up) {
 					p->stimer->st_cached_max_se = up->stimer.st_max_se;
+					unref_user(up, "unref user pointer from find_user call in st_get_se");
 					return (p->stimer->st_cached_max_se);
 				}
 			} 
@@ -18970,6 +18970,7 @@
 				struct sip_peer *pp = find_peer(p->peername, NULL, 1);
 				if (pp) {
 					p->stimer->st_cached_max_se = pp->stimer.st_max_se;
+					unref_peer(pp, "unref peer pointer from find_peer call in st_get_se");
 					return (p->stimer->st_cached_max_se);
 				}
 			}
@@ -18984,6 +18985,7 @@
 				struct sip_user *up = find_user(p->username, 1);
 				if (up) {
 					p->stimer->st_cached_min_se = up->stimer.st_min_se;
+					unref_user(up, "unref user pointer from find_user call in st_get_se (2)");
 					return (p->stimer->st_cached_min_se);
 				}
 			} 
@@ -18991,6 +18993,7 @@
 				struct sip_peer *pp = find_peer(p->peername, NULL, 1);
 				if (pp) {
 					p->stimer->st_cached_min_se = pp->stimer.st_min_se;
+					unref_peer(pp, "unref peer pointer from find_peer call in st_get_se (2)");
 					return (p->stimer->st_cached_min_se);
 				}
 			}
@@ -19013,6 +19016,7 @@
 		struct sip_user *up = find_user(p->username, 1);
 		if (up) {
 			p->stimer->st_cached_ref = up->stimer.st_ref;
+			unref_user(up, "unref user pointer from find_user call in st_get_refresher");
 			return up->stimer.st_ref;
 		}
 	} 
@@ -19021,6 +19025,7 @@
 		struct sip_peer *pp = find_peer(p->peername, NULL, 1);
 		if (pp) {
 			p->stimer->st_cached_ref = pp->stimer.st_ref;
+			unref_peer(pp, "unref peer pointer from find_peer call in st_get_refresher");
 			return pp->stimer.st_ref;
 		}
 	}
@@ -19045,6 +19050,7 @@
 		struct sip_user *up = find_user(p->username, 1);
 		if (up) {
 			p->stimer->st_cached_mode = up->stimer.st_mode_oper;
+			unref_user(up, "unref user pointer from find_user call in st_get_mode");
 			return up->stimer.st_mode_oper;
 		}
 	} 
@@ -19052,6 +19058,7 @@
 		struct sip_peer *pp = find_peer(p->peername, NULL, 1);
 		if (pp) {
 			p->stimer->st_cached_mode = pp->stimer.st_mode_oper;
+			unref_peer(pp, "unref peer pointer from find_peer call in st_get_mode");
 			return pp->stimer.st_mode_oper;
 		}
 	}
@@ -21521,7 +21528,7 @@
 				user = build_user(cat, ast_variable_browse(cfg, cat), 0);
 				if (user) {
 					ao2_t_link(users, user, "link user into users table");
-					unref_user(user, "unref_user from reload_config, near end");
+					unref_user(user, "Unref the result of build_user. Now, the table link is the only one left.");
 					user_count++;
 				}
 			}
@@ -21532,7 +21539,7 @@
 					if (peer->addr.sin_addr.s_addr) {
 						ao2_t_link(peers_by_ip, peer, "link peer into peers_by_ip table");
 					}
-					unref_peer(peer, "unref_peer: reload_config: just linked peer to two tables, peers and peers_by_ip");
+					unref_peer(peer, "unref the result of the build_peer call. Now, the links from the tables are the only ones left.");
 					peer_count++;
 				}
 			}




More information about the asterisk-commits mailing list