[asterisk-commits] tilghman: trunk r67864 - in /trunk: apps/ cdr/ channels/ codecs/ funcs/ main/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jun 6 14:20:13 MST 2007


Author: tilghman
Date: Wed Jun  6 16:20:11 2007
New Revision: 67864

URL: http://svn.digium.com/view/asterisk?view=rev&rev=67864
Log:
Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes

Modified:
    trunk/apps/app_adsiprog.c
    trunk/apps/app_alarmreceiver.c
    trunk/apps/app_dial.c
    trunk/apps/app_directory.c
    trunk/apps/app_externalivr.c
    trunk/apps/app_festival.c
    trunk/apps/app_followme.c
    trunk/apps/app_macro.c
    trunk/apps/app_meetme.c
    trunk/apps/app_milliwatt.c
    trunk/apps/app_minivm.c
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_queue.c
    trunk/apps/app_readfile.c
    trunk/apps/app_rpt.c
    trunk/apps/app_speech_utils.c
    trunk/apps/app_voicemail.c
    trunk/cdr/cdr_adaptive_odbc.c
    trunk/cdr/cdr_odbc.c
    trunk/cdr/cdr_pgsql.c
    trunk/cdr/cdr_sqlite.c
    trunk/cdr/cdr_tds.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_local.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_oss.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_vpb.cc
    trunk/channels/chan_zap.c
    trunk/channels/iax2-parser.c
    trunk/channels/iax2-provision.c
    trunk/channels/misdn_config.c
    trunk/codecs/codec_lpc10.c
    trunk/codecs/codec_zap.c
    trunk/funcs/func_callerid.c
    trunk/funcs/func_curl.c
    trunk/funcs/func_devstate.c
    trunk/funcs/func_enum.c
    trunk/funcs/func_odbc.c
    trunk/funcs/func_strings.c
    trunk/main/acl.c
    trunk/main/app.c
    trunk/main/asterisk.c
    trunk/main/autoservice.c
    trunk/main/callerid.c
    trunk/main/cdr.c
    trunk/main/channel.c
    trunk/main/chanvars.c
    trunk/main/cli.c
    trunk/main/config.c
    trunk/main/db.c
    trunk/main/devicestate.c
    trunk/main/dial.c
    trunk/main/dlfcn.c
    trunk/main/dnsmgr.c
    trunk/main/dsp.c
    trunk/main/enum.c
    trunk/main/event.c
    trunk/main/file.c
    trunk/main/fixedjitterbuf.c
    trunk/main/frame.c
    trunk/main/http.c
    trunk/main/indications.c
    trunk/main/io.c
    trunk/main/jitterbuf.c
    trunk/main/loader.c
    trunk/main/manager.c
    trunk/main/netsock.c
    trunk/main/pbx.c
    trunk/main/rtp.c
    trunk/main/say.c
    trunk/main/sched.c
    trunk/main/strcompat.c
    trunk/main/tdd.c
    trunk/main/threadstorage.c
    trunk/main/translate.c
    trunk/main/udptl.c
    trunk/main/utils.c
    trunk/res/res_agi.c
    trunk/res/res_config_pgsql.c
    trunk/res/res_config_sqlite.c
    trunk/res/res_features.c
    trunk/res/res_indications.c
    trunk/res/res_jabber.c
    trunk/res/res_monitor.c
    trunk/res/res_musiconhold.c
    trunk/res/res_odbc.c
    trunk/res/res_smdi.c
    trunk/res/res_speech.c

Modified: trunk/apps/app_adsiprog.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_adsiprog.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_adsiprog.c (original)
+++ trunk/apps/app_adsiprog.c Wed Jun  6 16:20:11 2007
@@ -1384,11 +1384,11 @@
 		break;
 	case STATE_INSUB:
 		ast_log(LOG_WARNING, "Missing ENDSUB at end of file %s\n", script);
-		free(scr);
+		ast_free(scr);
 		return NULL;
 	case STATE_INKEY:
 		ast_log(LOG_WARNING, "Missing ENDKEY at end of file %s\n", script);
-		free(scr);
+		ast_free(scr);
 		return NULL;
 	}
 	err = 0;
@@ -1414,7 +1414,7 @@
 	}
 
 	if (err) {
-		free(scr);
+		ast_free(scr);
 		return NULL;
 	}
 	return scr;
@@ -1451,7 +1451,7 @@
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_3 "User rejected download attempt\n");
 		ast_log(LOG_NOTICE, "User rejected download on channel %s\n", chan->name);
-		free(scr);
+		ast_free(scr);
 		return -1;
 	}
 
@@ -1538,10 +1538,10 @@
 		if (option_verbose > 2)
 			ast_verbose(VERBOSE_PREFIX_3 "Download attempt failed\n");
 		ast_log(LOG_NOTICE, "Download failed on %s\n", chan->name);
-		free(scr);
+		ast_free(scr);
 		return -1;
 	}
-	free(scr);
+	ast_free(scr);
 	ast_adsi_unload_session(chan);
 	return 0;
 }

Modified: trunk/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_alarmreceiver.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_alarmreceiver.c (original)
+++ trunk/apps/app_alarmreceiver.c Wed Jun  6 16:20:11 2007
@@ -727,7 +727,7 @@
 	for(elp = event_head; (elp != NULL);){
 		efree = elp;
 		elp = elp->next;
-		free(efree);
+		ast_free(efree);
 	}
 
 

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Wed Jun  6 16:20:11 2007
@@ -312,7 +312,7 @@
 			ast_hangup(outgoing->chan);
 		oo = outgoing;
 		outgoing=outgoing->next;
-		free(oo);
+		ast_free(oo);
 	}
 }
 
@@ -1327,7 +1327,7 @@
 			handle_cause(cause, &num);
 			if (!rest)	/* we are on the last destination */
 				chan->hangupcause = cause;
-			free(tmp);
+			ast_free(tmp);
 			continue;
 		}
 		pbx_builtin_setvar_helper(tc, "DIALEDPEERNUMBER", numsubst);
@@ -1374,7 +1374,7 @@
 			}
 			if (!tc) {
 				handle_cause(cause, &num);
-				free(tmp);
+				ast_free(tmp);
 				continue;
 			}
 		}
@@ -1436,7 +1436,7 @@
 				ast_verbose(VERBOSE_PREFIX_3 "Couldn't call %s\n", numsubst);
 			ast_hangup(tc);
 			tc = NULL;
-			free(tmp);
+			ast_free(tmp);
 			continue;
 		} else {
 			senddialevent(chan, tc);

Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Wed Jun  6 16:20:11 2007
@@ -463,14 +463,14 @@
 							if (!strncmp(conv, ext, strlen(ext))) {
 								/* Match! */
 								found++;
-								free(conv);
-								free(start);
+								ast_free(conv);
+								ast_free(start);
 								break;
 							}
-							free(conv);
+							ast_free(conv);
 						}
 					}
-					free(start);
+					ast_free(start);
 				}
 				v = v->next;
 			}
@@ -547,10 +547,10 @@
 							default:
 								break;
 							}
-							free(conv);
+							ast_free(conv);
 							break;
 						}
-						free(conv);
+						ast_free(conv);
 					}
 				}
 			}

Modified: trunk/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_externalivr.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Wed Jun  6 16:20:11 2007
@@ -136,7 +136,7 @@
 	struct gen_state *state = data;
 
 	gen_closestream(state);
-	free(data);
+	ast_free(data);
 }
 
 /* caller has the playlist locked */
@@ -399,7 +399,7 @@
 				AST_LIST_LOCK(&u->finishlist);
 				while ((entry = AST_LIST_REMOVE_HEAD(&u->finishlist, list))) {
 					send_child_event(child_events, 'F', entry->filename, chan);
-					free(entry);
+					ast_free(entry);
 				}
 				AST_LIST_UNLOCK(&u->finishlist);
 			}
@@ -422,7 +422,7 @@
 						AST_LIST_LOCK(&u->playlist);
 						while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
 							send_child_event(child_events, 'D', entry->filename, chan);
-							free(entry);
+							ast_free(entry);
 						}
 						if (!u->playing_silence)
 							u->abort_current_sound = 1;
@@ -467,7 +467,7 @@
 					AST_LIST_LOCK(&u->playlist);
 					while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) {
 						send_child_event(child_events, 'D', entry->filename, chan);
-						free(entry);
+						ast_free(entry);
 					}
 					if (!u->playing_silence)
 						u->abort_current_sound = 1;
@@ -569,7 +569,7 @@
 		close(child_stderr[1]);
 
 	while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list)))
-		free(entry);
+		ast_free(entry);
 
 	ast_module_user_remove(lu);
 

Modified: trunk/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_festival.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Wed Jun  6 16:20:11 2007
@@ -525,7 +525,7 @@
 				ast_log(LOG_DEBUG,"Festival WV command\n");
 			waveform = socket_receive_file_to_buff(fd,&filesize);
 			res = send_waveform_to_channel(chan,waveform,filesize, intstr);
-			free(waveform);
+			ast_free(waveform);
 			break;
 		}
 		else if (strcmp(ack,"LP\n") == 0) {   /* receive an s-expr */
@@ -534,7 +534,7 @@
 			waveform = socket_receive_file_to_buff(fd,&filesize);
 			waveform[filesize]='\0';
 			ast_log(LOG_WARNING,"Festival returned LP : %s\n",waveform);
-			free(waveform);
+			ast_free(waveform);
 		} else if (strcmp(ack,"ER\n") == 0) {    /* server got an error */
 			ast_log(LOG_WARNING,"Festival returned ER\n");
 			res=-1;

Modified: trunk/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_followme.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Wed Jun  6 16:20:11 2007
@@ -172,17 +172,17 @@
 
 	while ((prev = AST_LIST_REMOVE_HEAD(&f->numbers, entry)))
 		/* Free the number */
-		free(prev);
+		ast_free(prev);
 	AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
 
 	while ((prev = AST_LIST_REMOVE_HEAD(&f->blnumbers, entry)))
 		/* Free the blacklisted number */
-		free(prev);
+		ast_free(prev);
 	AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
 
 	while ((prev = AST_LIST_REMOVE_HEAD(&f->wlnumbers, entry)))
 		/* Free the whitelisted number */
-		free(prev);
+		ast_free(prev);
 	AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
 	
 }
@@ -815,7 +815,7 @@
 			tmpuser = ast_calloc(1, sizeof(*tmpuser));
 			if (!tmpuser) {
 				ast_log(LOG_WARNING, "Out of memory!\n");
-				free(findme_user_list);
+				ast_free(findme_user_list);
 				return;
 			}
 					
@@ -872,7 +872,7 @@
 			if (!fmuser->cleared && fmuser->ochan != winner)
 				clear_caller(fmuser);
 			AST_LIST_REMOVE_CURRENT(findme_user_list, entry);
-			free(fmuser);
+			ast_free(fmuser);
 		}
 		AST_LIST_TRAVERSE_SAFE_END
 		fmuser = NULL;
@@ -883,7 +883,7 @@
 
 		if (!caller) {
 			tpargs->status = 1;
-			free(findme_user_list);
+			ast_free(findme_user_list);
 			return;	
 		}
 
@@ -893,7 +893,7 @@
 				break;
 
 	}
-	free(findme_user_list);
+	ast_free(findme_user_list);
 	if (!winner) 
 		tpargs->status = 1;
 	else {
@@ -1012,7 +1012,7 @@
 				
 		AST_LIST_TRAVERSE_SAFE_BEGIN(&targs.cnumbers, nm, entry) {
 			AST_LIST_REMOVE_CURRENT(&targs.cnumbers, entry);
-			free(nm);
+			ast_free(nm);
 		}
 		AST_LIST_TRAVERSE_SAFE_END
 	
@@ -1075,7 +1075,7 @@
 	AST_LIST_LOCK(&followmes);
 	while ((f = AST_LIST_REMOVE_HEAD(&followmes, entry))) {
 		free_numbers(f);
-		free(f);
+		ast_free(f);
 	}
 
 	AST_LIST_UNLOCK(&followmes);

Modified: trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_macro.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Wed Jun  6 16:20:11 2007
@@ -422,7 +422,7 @@
   		if (oldargs[x]) {
 			if (!dead)
 				pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
-			free(oldargs[x]);
+			ast_free(oldargs[x]);
 		} else if (!dead) {
 			pbx_builtin_setvar_helper(chan, varname, NULL);
 		}
@@ -435,11 +435,11 @@
 		pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
 	}
 	if (save_macro_exten)
-		free(save_macro_exten);
+		ast_free(save_macro_exten);
 	if (save_macro_context)
-		free(save_macro_context);
+		ast_free(save_macro_context);
 	if (save_macro_priority)
-		free(save_macro_priority);
+		ast_free(save_macro_priority);
 
 	if (!dead && setmacrocontext) {
 		chan->macrocontext[0] = '\0';
@@ -470,7 +470,7 @@
 	if (!dead)
 		pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
 	if (save_macro_offset)
-		free(save_macro_offset);
+		ast_free(save_macro_offset);
 
 	/* Unlock the macro */
 	if (exclusive) {

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Wed Jun  6 16:20:11 2007
@@ -765,7 +765,7 @@
 		cnf->fd = open("/dev/zap/pseudo", O_RDWR);
 		if (cnf->fd < 0) {
 			ast_log(LOG_WARNING, "Unable to open pseudo device\n");
-			free(cnf);
+			ast_free(cnf);
 			cnf = NULL;
 			goto cnfout;
 		}
@@ -780,7 +780,7 @@
 			ast_hangup(cnf->chan);
 		else
 			close(cnf->fd);
-		free(cnf);
+		ast_free(cnf);
 		cnf = NULL;
 		goto cnfout;
 	}
@@ -1247,7 +1247,7 @@
 	else
 		close(conf->fd);
 	
-	free(conf);
+	ast_free(conf);
 
 	return 0;
 }
@@ -2278,7 +2278,7 @@
 		snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime));
 		pbx_builtin_setvar_helper(chan, "MEETMESECS", meetmesecs);
 	}
-	free(user);
+	ast_free(user);
 	AST_LIST_UNLOCK(&confs);
 
 	return ret;
@@ -3348,9 +3348,9 @@
 	sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
 
 	while ((station_ref = AST_LIST_REMOVE_HEAD(&ringing_trunk->timed_out_stations, entry)))
-		free(station_ref);
-
-	free(ringing_trunk);
+		ast_free(station_ref);
+
+	ast_free(ringing_trunk);
 }
 
 static void sla_stop_ringing_station(struct sla_ringing_station *ringing_station,
@@ -3385,7 +3385,7 @@
 	}
 
 done:
-	free(ringing_station);
+	ast_free(ringing_station);
 }
 
 static void sla_dial_state_callback(struct ast_dial *dial)
@@ -3496,8 +3496,8 @@
 			args.station = ringing_station->station;
 			args.cond = &cond;
 			args.cond_lock = &cond_lock;
-			free(ringing_trunk);
-			free(ringing_station);
+			ast_free(ringing_trunk);
+			ast_free(ringing_station);
 			ast_mutex_init(&cond_lock);
 			ast_cond_init(&cond, NULL);
 			ast_mutex_lock(&cond_lock);
@@ -3551,7 +3551,7 @@
 			continue;
 		if (ast_tvdiff_ms(ast_tvnow(), failed_station->last_try) > 1000) {
 			AST_LIST_REMOVE_CURRENT(&sla.failed_stations, entry);
-			free(failed_station);
+			ast_free(failed_station);
 			break;
 		}
 		res = 1;
@@ -3586,12 +3586,12 @@
 
 	if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_name)) {
 		cid_name = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_name);
-		free(ringing_trunk->trunk->chan->cid.cid_name);
+		ast_free(ringing_trunk->trunk->chan->cid.cid_name);
 		ringing_trunk->trunk->chan->cid.cid_name = NULL;
 	}
 	if (!sla.attempt_callerid && !ast_strlen_zero(ringing_trunk->trunk->chan->cid.cid_num)) {
 		cid_num = ast_strdupa(ringing_trunk->trunk->chan->cid.cid_num);
-		free(ringing_trunk->trunk->chan->cid.cid_num);
+		ast_free(ringing_trunk->trunk->chan->cid.cid_num);
 		ringing_trunk->trunk->chan->cid.cid_num = NULL;
 	}
 
@@ -3753,7 +3753,7 @@
 			ast_dial_join(ringing_station->station->dial);
 			ast_dial_destroy(ringing_station->station->dial);
 			ringing_station->station->dial = NULL;
-			free(ringing_station);
+			ast_free(ringing_station);
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END
@@ -4018,7 +4018,7 @@
 				sla_handle_ringing_trunk_event();
 				break;
 			}
-			free(event);
+			ast_free(event);
 			ast_mutex_lock(&sla.lock);
 		}
 	}
@@ -4026,10 +4026,10 @@
 	ast_mutex_unlock(&sla.lock);
 
 	while ((ringing_station = AST_LIST_REMOVE_HEAD(&sla.ringing_stations, entry)))
-		free(ringing_station);
+		ast_free(ringing_station);
 
 	while ((failed_station = AST_LIST_REMOVE_HEAD(&sla.failed_stations, entry)))
-		free(failed_station);
+		ast_free(failed_station);
 
 	return NULL;
 }
@@ -4072,12 +4072,12 @@
 
 	if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_name)) {
 		cid_name = ast_strdupa(trunk_ref->chan->cid.cid_name);
-		free(trunk_ref->chan->cid.cid_name);
+		ast_free(trunk_ref->chan->cid.cid_name);
 		trunk_ref->chan->cid.cid_name = NULL;
 	}
 	if (!sla.attempt_callerid && !ast_strlen_zero(trunk_ref->chan->cid.cid_num)) {
 		cid_num = ast_strdupa(trunk_ref->chan->cid.cid_num);
-		free(trunk_ref->chan->cid.cid_num);
+		ast_free(trunk_ref->chan->cid.cid_num);
 		trunk_ref->chan->cid.cid_num = NULL;
 	}
 
@@ -4389,7 +4389,7 @@
 	ast_mutex_unlock(&sla.lock);
 	if (ringing_trunk) {
 		sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
-		free(ringing_trunk);
+		ast_free(ringing_trunk);
 		pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "UNANSWERED");
 		/* Queue reprocessing of ringing trunks to make stations stop ringing
 		 * that shouldn't be ringing after this trunk stopped. */
@@ -4457,10 +4457,10 @@
 		ast_context_remove_extension(trunk->autocontext, "s", 1, sla_registrar);
 
 	while ((station_ref = AST_LIST_REMOVE_HEAD(&trunk->stations, entry)))
-		free(station_ref);
+		ast_free(station_ref);
 
 	ast_string_field_free_all(trunk);
-	free(trunk);
+	ast_free(trunk);
 }
 
 static void destroy_station(struct sla_station *station)
@@ -4483,10 +4483,10 @@
 	}
 
 	while ((trunk_ref = AST_LIST_REMOVE_HEAD(&station->trunks, entry)))
-		free(trunk_ref);
+		ast_free(trunk_ref);
 
 	ast_string_field_free_all(station);
-	free(station);
+	ast_free(station);
 }
 
 static void sla_destroy(void)
@@ -4549,7 +4549,7 @@
 	if (!(trunk = ast_calloc(1, sizeof(*trunk))))
 		return -1;
 	if (ast_string_field_init(trunk, 32)) {
-		free(trunk);
+		ast_free(trunk);
 		return -1;
 	}
 
@@ -4654,7 +4654,7 @@
 	}
 
 	if (!(station_ref = sla_create_station_ref(station))) {
-		free(trunk_ref);
+		ast_free(trunk_ref);
 		return;
 	}
 	ast_atomic_fetchadd_int((int *) &trunk->num_stations, 1);
@@ -4678,7 +4678,7 @@
 	if (!(station = ast_calloc(1, sizeof(*station))))
 		return -1;
 	if (ast_string_field_init(station, 32)) {
-		free(station);
+		ast_free(station);
 		return -1;
 	}
 

Modified: trunk/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_milliwatt.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_milliwatt.c (original)
+++ trunk/apps/app_milliwatt.c Wed Jun  6 16:20:11 2007
@@ -59,7 +59,7 @@
 
 static void milliwatt_release(struct ast_channel *chan, void *data)
 {
-	free(data);
+	ast_free(data);
 	return;
 }
 

Modified: trunk/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_minivm.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_minivm.c (original)
+++ trunk/apps/app_minivm.c Wed Jun  6 16:20:11 2007
@@ -470,7 +470,7 @@
 {
 	struct minivm_template *template;
 
-	template = ast_calloc(1, sizeof(struct minivm_template));
+	template = ast_calloc(1, sizeof(*template));
 	if (!template)
 		return NULL;
 
@@ -488,9 +488,9 @@
 static void message_template_free(struct minivm_template *template)
 {
 	if (template->body)
-		free(template->body);
-
-	free (template);
+		ast_free(template->body);
+
+	ast_free (template);
 }
 
 /*! \brief Build message template from configuration */
@@ -524,7 +524,7 @@
 			ast_copy_string(template->charset, var->value, sizeof(template->charset));
 		} else if (!strcasecmp(var->name, "templatefile")) {
 			if (template->body) 
-				free(template->body);
+				ast_free(template->body);
 			template->body = message_template_parse_filebody(var->value);
 			if (!template->body) {
 				ast_log(LOG_ERROR, "Error reading message body definition file %s\n", var->value);
@@ -532,7 +532,7 @@
 			}
 		} else if (!strcasecmp(var->name, "messagebody")) {
 			if (template->body) 
-				free(template->body);
+				ast_free(template->body);
 			template->body = message_template_parse_emailbody(var->value);
 			if (!template->body) {
 				ast_log(LOG_ERROR, "Error parsing message body definition:\n          %s\n", var->value);
@@ -727,7 +727,7 @@
 {
 	if (vmu->chanvars)
 		ast_variables_destroy(vmu->chanvars);
-	free(vmu);
+	ast_free(vmu);
 }
 
 
@@ -793,7 +793,7 @@
 {
 	struct minivm_account *new;
 
-	new = calloc(1, sizeof(struct minivm_account));
+	new = ast_calloc(1, sizeof(*new));
 	if (!new)
 		return NULL;
 	populate_defaults(new);
@@ -808,7 +808,7 @@
 	struct minivm_account *this;
 	AST_LIST_LOCK(&minivm_accounts);
 	while ((this = AST_LIST_REMOVE_HEAD(&minivm_accounts, list))) 
-		free(this);
+		ast_free(this);
 	AST_LIST_UNLOCK(&minivm_accounts);
 }
 
@@ -877,7 +877,7 @@
 	var = ast_load_realtime("minivm", "username", username, "domain", domain, NULL);
 
 	if (!var) {
-		free(retval);
+		ast_free(retval);
 		return NULL;
 	}
 
@@ -2201,7 +2201,7 @@
 		ast_log(LOG_DEBUG, "Creating static account for user %s domain %s\n", username, domain);
 
 	/* Allocate user account */
-	vmu = ast_calloc(1, sizeof(struct minivm_account));
+	vmu = ast_calloc(1, sizeof(*vmu));
 	if (!vmu)
 		return 0;
 	
@@ -2277,7 +2277,7 @@
 /*! \brief Free Mini Voicemail timezone */
 static void free_zone(struct minivm_zone *z)
 {
-	free(z);
+	ast_free(z);
 }
 
 /*! \brief Clear list of timezones */
@@ -2299,21 +2299,21 @@
 	struct minivm_zone *newzone;
 	char *msg_format, *timezone;
 
-	newzone = ast_calloc(1, sizeof(struct minivm_zone));
+	newzone = ast_calloc(1, sizeof(*newzone));
 	if (newzone == NULL)
 		return 0;
 
 	msg_format = ast_strdupa(config);
 	if (msg_format == NULL) {
 		ast_log(LOG_WARNING, "Out of memory.\n");
-		free(newzone);
+		ast_free(newzone);
 		return 0;
 	}
 
 	timezone = strsep(&msg_format, "|");
 	if (!msg_format) {
 		ast_log(LOG_WARNING, "Invalid timezone definition : %s\n", zonename);
-		free(newzone);
+		ast_free(newzone);
 		return 0;
 	}
 			

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Wed Jun  6 16:20:11 2007
@@ -220,7 +220,7 @@
 	if (fs)
 		ast_closestream(fs);
 
-	free(mixmonitor);
+	ast_free(mixmonitor);
 
 
 	return NULL;
@@ -253,7 +253,7 @@
 	}
 
 	/* Pre-allocate mixmonitor structure and spy */
-	if (!(mixmonitor = calloc(1, len))) {
+	if (!(mixmonitor = ast_calloc(1, len))) {
 		return;
 	}
 
@@ -291,7 +291,7 @@
 			mixmonitor->spy.type, chan->name);
 		/* Since we couldn't add ourselves - bail out! */
 		ast_mutex_destroy(&mixmonitor->spy.lock);
-		free(mixmonitor);
+		ast_free(mixmonitor);
 		return;
 	}
 

Modified: trunk/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_osplookup.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Wed Jun  6 16:20:11 2007
@@ -328,7 +328,7 @@
 	error = OSPPUtilLoadPEMPrivateKey((unsigned char*)p->privatekey, &privatekey);
 	if (error != OSPC_ERR_NO_ERROR) {
 		ast_log(LOG_WARNING, "OSP: Unable to load privatekey '%s', error '%d'\n", p->privatekey, error);
-		free(p);
+		ast_free(p);
 		return 0;
 	}
 
@@ -336,9 +336,9 @@
 	if (error != OSPC_ERR_NO_ERROR) {
 		ast_log(LOG_WARNING, "OSP: Unable to load localcert '%s', error '%d'\n", p->localcert, error);
 		if (privatekey.PrivateKeyData) {
-			free(privatekey.PrivateKeyData);
-		}
-		free(p);
+			ast_free(privatekey.PrivateKeyData);
+		}
+		ast_free(p);
 		return 0;
 	}
 
@@ -354,16 +354,16 @@
 			ast_log(LOG_WARNING, "OSP: Unable to load cacert '%s', error '%d'\n", p->cacerts[i], error);
 			for (j = 0; j < i; j++) {
 				if (cacerts[j].CertData) {
-					free(cacerts[j].CertData);
+					ast_free(cacerts[j].CertData);
 				}
 			}
 			if (localcert.CertData) {
-				free(localcert.CertData);
+				ast_free(localcert.CertData);
 			}
 			if (privatekey.PrivateKeyData) {
-				free(privatekey.PrivateKeyData);
-			}
-			free(p);
+				ast_free(privatekey.PrivateKeyData);
+			}
+			ast_free(p);
 			return 0;
 		}
 		pcacerts[i] = &cacerts[i];
@@ -394,7 +394,7 @@
 				&p->handle);
 	if (error != OSPC_ERR_NO_ERROR) {
 		ast_log(LOG_WARNING, "OSP: Unable to create provider '%s', error '%d'\n", provider, error);
-		free(p);
+		ast_free(p);
 		res = -1;
 	} else {
 		if (option_debug)
@@ -408,14 +408,14 @@
 
 	for (i = 0; i < p->cacount; i++) {
 		if (cacerts[i].CertData) {
-			free(cacerts[i].CertData);
+			ast_free(cacerts[i].CertData);
 		}
 	}
 	if (localcert.CertData) {
-		free(localcert.CertData);
+		ast_free(localcert.CertData);
 	}
 	if (privatekey.PrivateKeyData) {
-		free(privatekey.PrivateKeyData);
+		ast_free(privatekey.PrivateKeyData);
 	}
 
 	return res;
@@ -2009,7 +2009,7 @@
 		while(p) {
 			next = p->next;
 			OSPPProviderDelete(p->handle, 0);
-			free(p);
+			ast_free(p);
 			p = next;
 		}
 		ospproviders = NULL;

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed Jun  6 16:20:11 2007
@@ -831,7 +831,7 @@
 				if (option_debug)
 					ast_log(LOG_DEBUG, "Removing %s from the list of interfaces that make up all of our queue members.\n", interface);
 				AST_LIST_REMOVE_CURRENT(&interfaces, list);
-				free(curint);
+				ast_free(curint);
 			}
 			break;
 		}
@@ -848,7 +848,7 @@
 
 	AST_LIST_LOCK(&interfaces);
 	while ((curint = AST_LIST_REMOVE_HEAD(&interfaces, list)))
-		free(curint);
+		ast_free(curint);
 	AST_LIST_UNLOCK(&interfaces);
 }
 
@@ -1076,7 +1076,7 @@
 			else
 				q->members = next;
 			remove_from_interfaces(curm->interface);
-			free(curm);
+			ast_free(curm);
 		} else
 			prev = curm;
 	}
@@ -1086,7 +1086,7 @@
 {
 	free_members(q, 1);
 	ast_mutex_destroy(&q->lock);
-	free(q);
+	ast_free(q);
 }
 
 /*!\brief Reload a single queue via realtime.
@@ -1196,7 +1196,7 @@
 				q->members = next_m;
 			}
 			remove_from_interfaces(m->interface);
-			free(m);
+			ast_free(m);
 		} else {
 			prev_m = m;
 		}
@@ -1546,7 +1546,7 @@
 			ast_hangup(outgoing->chan);
 		oo = outgoing;
 		outgoing = outgoing->q_next;
-		free(oo);
+		ast_free(oo);
 	}
 }
 
@@ -1747,13 +1747,13 @@
 	tmp->chan->data = "(Outgoing Line)";
 	tmp->chan->whentohangup = 0;
 	if (tmp->chan->cid.cid_num)
-		free(tmp->chan->cid.cid_num);
+		ast_free(tmp->chan->cid.cid_num);
 	tmp->chan->cid.cid_num = ast_strdup(qe->chan->cid.cid_num);
 	if (tmp->chan->cid.cid_name)
-		free(tmp->chan->cid.cid_name);
+		ast_free(tmp->chan->cid.cid_name);
 	tmp->chan->cid.cid_name = ast_strdup(qe->chan->cid.cid_name);
 	if (tmp->chan->cid.cid_ani)
-		free(tmp->chan->cid.cid_ani);
+		ast_free(tmp->chan->cid.cid_ani);
 	tmp->chan->cid.cid_ani = ast_strdup(qe->chan->cid.cid_ani);
 
 	/* Inherit specially named variables from parent channel */
@@ -2067,11 +2067,11 @@
 					} else {
 						ast_channel_inherit_variables(in, o->chan);
 						if (o->chan->cid.cid_num)
-							free(o->chan->cid.cid_num);
+							ast_free(o->chan->cid.cid_num);
 						o->chan->cid.cid_num = ast_strdup(in->cid.cid_num);
 
 						if (o->chan->cid.cid_name)
-							free(o->chan->cid.cid_name);
+							ast_free(o->chan->cid.cid_name);
 						o->chan->cid.cid_name = ast_strdup(in->cid.cid_name);
 
 						ast_string_field_set(o->chan, accountcode, in->accountcode);
@@ -2079,11 +2079,11 @@
 
 						if (in->cid.cid_ani) {
 							if (o->chan->cid.cid_ani)
-								free(o->chan->cid.cid_ani);
+								ast_free(o->chan->cid.cid_ani);
 							o->chan->cid.cid_ani = ast_strdup(in->cid.cid_ani);
 						}
 						if (o->chan->cid.cid_rdnis)
-							free(o->chan->cid.cid_rdnis);
+							ast_free(o->chan->cid.cid_rdnis);
 						o->chan->cid.cid_rdnis = ast_strdup(S_OR(in->macroexten, in->exten));
 						if (ast_call(o->chan, tmpchan, 0)) {
 							ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
@@ -2547,7 +2547,7 @@
 			if (outgoing->chan && (outgoing->chan->_state == AST_STATE_UP))
 				break;
 		} else {
-			free(tmp);
+			ast_free(tmp);
 		}
 	}
 	if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
@@ -2964,7 +2964,7 @@
 				"Location: %s\r\n"
 				"MemberName: %s\r\n",
 				q->name, last_member->interface, last_member->membername);
-			free(last_member);
+			ast_free(last_member);
 			
 			if (queue_persistent_members)
 				dump_queue_members(q);
@@ -4087,7 +4087,7 @@
 							} else {
 								q->members = newm;
 							}
-							free(cur);
+							ast_free(cur);
 						} else {
 							/* Add them to the master int list if necessary */
 							add_to_interfaces(interface);
@@ -4116,7 +4116,7 @@
 						q->members = next;
 
 					remove_from_interfaces(cur->interface);
-					free(cur);
+					ast_free(cur);
 				}
 
 				if (new) {

Modified: trunk/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_readfile.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_readfile.c (original)
+++ trunk/apps/app_readfile.c Wed Jun  6 16:20:11 2007
@@ -94,7 +94,7 @@
 				ast_log(LOG_WARNING, "%s is longer than %d, and %d \n", file, len, (int)strlen(returnvar));
 		}
 		pbx_builtin_setvar_helper(chan, varname, returnvar);
-		free(returnvar);
+		ast_free(returnvar);
 	}
 	ast_module_user_remove(u);
 	return res;

Modified: trunk/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_rpt.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_rpt.c (original)
+++ trunk/apps/app_rpt.c Wed Jun  6 16:20:11 2007
@@ -1353,7 +1353,7 @@
 					l = l->next;
 					continue;
 				}
-				if ((s = (struct rpt_lstat *) ast_calloc(1, sizeof(struct rpt_lstat))) == NULL) {
+				if ((s = ast_calloc(1, sizeof(*s))) == NULL) {
 					ast_log(LOG_ERROR, "Malloc failed in rpt_do_lstats\n");
 					rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
 					return RESULT_FAILURE;
@@ -2186,7 +2186,7 @@
 				l = l->next;
 				continue;
 			}
-			m = ast_malloc(sizeof(struct rpt_link));
+			m = ast_malloc(sizeof(*m));
 			if (!m) {
 				ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", mychannel->name);
 				remque((struct qelem *)mytele);
@@ -2453,7 +2453,7 @@
 	struct rpt_link *mylink = (struct rpt_link *) data;
 	int res;
 
-	tele = ast_calloc(1, sizeof(struct rpt_tele));
+	tele = ast_calloc(1, sizeof(*tele));
 	if (!tele) {
 		ast_log(LOG_WARNING, "Unable to allocate memory\n");
 		pthread_exit(NULL);
@@ -2869,7 +2869,7 @@
 			rpt_mutex_unlock(&myrpt->lock);
 		ast_copy_string(myrpt->lastlinknode, digitbuf, MAXNODESTR);
 		/* establish call in monitor mode */
-		l = ast_calloc(1, sizeof(struct rpt_link));
+		l = ast_calloc(1, sizeof(*l));
 		if (!l) {
 			ast_log(LOG_WARNING, "Unable to malloc\n");
 			return DC_ERROR;
@@ -2979,7 +2979,7 @@
 			rpt_mutex_unlock(&myrpt->lock);
 		ast_copy_string(myrpt->lastlinknode, digitbuf, MAXNODESTR);
 		/* establish call in tranceive mode */
-		l = ast_calloc(1, sizeof(struct rpt_link));
+		l = ast_calloc(1, sizeof(*l));
 		if (!l) {
 			ast_log(LOG_WARNING, "Unable to malloc\n");
 			return DC_ERROR;
@@ -6982,7 +6982,7 @@
 		} else 
 			rpt_mutex_unlock(&myrpt->lock);
 		/* establish call in tranceive mode */
-		l = ast_calloc(1, sizeof(struct rpt_link));
+		l = ast_calloc(1, sizeof(*l));
 		if (!l) {
 			ast_log(LOG_WARNING, "Unable to malloc\n");
 			pthread_exit(NULL);

Modified: trunk/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_speech_utils.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_speech_utils.c (original)
+++ trunk/apps/app_speech_utils.c Wed Jun  6 16:20:11 2007
@@ -511,7 +511,7 @@
         }
 
 	if (speech->processing_sound != NULL) {
-		free(speech->processing_sound);
+		ast_free(speech->processing_sound);
 		speech->processing_sound = NULL;
 	}
 

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Wed Jun  6 16:20:11 2007
@@ -793,7 +793,7 @@
 			ast_variables_destroy(var);
 		} else { 
 			if (!ivm) 
-				free(retval);
+				ast_free(retval);
 			retval = NULL;
 		}	
 	} 
@@ -2287,12 +2287,12 @@
 	if (!ast_test_flag(vmu, VM_ALLOCED))
 		return;
 
-	free(vmu);
+	ast_free(vmu);
 }
 
 static void free_zone(struct vm_zone *z)
 {
-	free(z);
+	ast_free(z);
 }
 
 static const char *mbox(int id)
@@ -8047,10 +8047,9 @@
 								AST_LIST_UNLOCK(&zones);
 							} else {
 								ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
-								free(z);
+								ast_free(z);
 							}
 						} else {
-							free(z);
 							AST_LIST_UNLOCK(&users);
 							ast_config_destroy(cfg);
 							return -1;
@@ -8066,19 +8065,19 @@
 		memset(emailtitle,0,sizeof(emailtitle));
 		strcpy(charset, "ISO-8859-1");
 		if (emailbody) {
-			free(emailbody);
+			ast_free(emailbody);
 			emailbody = NULL;
 		}
 		if (emailsubject) {
-			free(emailsubject);
+			ast_free(emailsubject);
 			emailsubject = NULL;
 		}
 		if (pagerbody) {
-			free(pagerbody);
+			ast_free(pagerbody);
 			pagerbody = NULL;
 		}
 		if (pagersubject) {
-			free(pagersubject);
+			ast_free(pagersubject);
 			pagersubject = NULL;
 		}
 		if ((s = ast_variable_retrieve(cfg, "general", "pbxskip")))
@@ -8938,7 +8937,7 @@
 		ast_variables_destroy(var);
 		return vmu;
 	} else {
-		free(vmu);
+		ast_free(vmu);
 		return NULL;
 	}
 }
@@ -9320,7 +9319,7 @@
 	AST_LIST_UNLOCK(&vmstates);
 	
 	if (vc)
-		free(vc);
+		ast_free(vc);
 	else
 		ast_log(LOG_ERROR, "No vmstate found for user:%s, mailbox %s\n", vms->imapuser, vms->username);
 }

Modified: trunk/cdr/cdr_adaptive_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_adaptive_odbc.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/cdr/cdr_adaptive_odbc.c (original)
+++ trunk/cdr/cdr_adaptive_odbc.c Wed Jun  6 16:20:11 2007
@@ -211,7 +211,7 @@
 		if (AST_LIST_FIRST(&(tableptr->columns)))
 			AST_RWLIST_INSERT_TAIL(&odbc_tables, tableptr, list);
 		else
-			free(tableptr);
+			ast_free(tableptr);
 	}
 	return res;
 }

Modified: trunk/cdr/cdr_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_odbc.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/cdr/cdr_odbc.c (original)
+++ trunk/cdr/cdr_odbc.c Wed Jun  6 16:20:11 2007
@@ -218,22 +218,22 @@
 	if (dsn) {
 		if (option_verbose > 10)
 			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free dsn\n");
-		free(dsn);
+		ast_free(dsn);
 	}
 	if (username) {
 		if (option_verbose > 10)
 			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free username\n");
-		free(username);
+		ast_free(username);
 	}
 	if (password) {
 		if (option_verbose > 10)
 			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free password\n");
-		free(password);
+		ast_free(password);
 	}
 	if (table) {
 		if (option_verbose > 10)
 			ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: free table\n");
-		free(table);
+		ast_free(table);
 	}
 
 	ast_cdr_unregister(name);

Modified: trunk/cdr/cdr_pgsql.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_pgsql.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/cdr/cdr_pgsql.c (original)
+++ trunk/cdr/cdr_pgsql.c Wed Jun  6 16:20:11 2007
@@ -184,17 +184,17 @@
 	if (conn)
 		PQfinish(conn);
 	if (pghostname)
-		free(pghostname);
+		ast_free(pghostname);
 	if (pgdbname)
-		free(pgdbname);
+		ast_free(pgdbname);
 	if (pgdbuser)
-		free(pgdbuser);
+		ast_free(pgdbuser);
 	if (pgpassword)
-		free(pgpassword);
+		ast_free(pgpassword);
 	if (pgdbport)
-		free(pgdbport);
+		ast_free(pgdbport);
 	if (table)
-		free(table);
+		ast_free(table);
 	ast_cdr_unregister(name);
 	return 0;
 }

Modified: trunk/cdr/cdr_sqlite.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_sqlite.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/cdr/cdr_sqlite.c (original)
+++ trunk/cdr/cdr_sqlite.c Wed Jun  6 16:20:11 2007
@@ -161,7 +161,7 @@
 	
 	if (zErr) {
 		ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr);
-		free(zErr);
+		ast_free(zErr);
 	}
 
 	ast_mutex_unlock(&sqlite_lock);
@@ -190,7 +190,7 @@
 	db = sqlite_open(fn, AST_FILE_MODE, &zErr);
 	if (!db) {
 		ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr);
-		free(zErr);
+		ast_free(zErr);
 		return -1;
 	}
 
@@ -200,7 +200,7 @@
 		res = sqlite_exec(db, sql_create_table, NULL, NULL, &zErr);
 		if (res) {
 			ast_log(LOG_ERROR, "cdr_sqlite: Unable to create table 'cdr': %s\n", zErr);
-			free(zErr);
+			ast_free(zErr);
 			goto err;
 		}
 

Modified: trunk/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_tds.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/cdr/cdr_tds.c (original)
+++ trunk/cdr/cdr_tds.c Wed Jun  6 16:20:11 2007
@@ -221,16 +221,16 @@
 		}
 	} while (!connected && !retried);
 
-	free(accountcode);
-	free(src);
-	free(dst);
-	free(dcontext);
-	free(clid);
-	free(channel);
-	free(dstchannel);
-	free(lastapp);
-	free(lastdata);
-	free(uniqueid);
+	ast_free(accountcode);
+	ast_free(src);
+	ast_free(dst);
+	ast_free(dcontext);
+	ast_free(clid);
+	ast_free(channel);
+	ast_free(dstchannel);
+	ast_free(lastapp);
+	ast_free(lastdata);
+	ast_free(uniqueid);
 
 	ast_mutex_unlock(&tds_lock);
 
@@ -246,7 +246,7 @@
 	char *known_bad[] = {"select", "insert", "update", "delete", "drop", ";", "--", "\0"};
 	int idx;
 
-	if ((buf = malloc(len + 1)) == NULL)
+	if ((buf = ast_malloc(len + 1)) == NULL)
 	{
 		ast_log(LOG_ERROR, "cdr_tds:  Out of memory error\n");
 		return NULL;
@@ -413,13 +413,13 @@
 
 	ast_cdr_unregister(name);
 
-	if (hostname) free(hostname);
-	if (dbname) free(dbname);
-	if (dbuser) free(dbuser);
-	if (password) free(password);
-	if (charset) free(charset);
-	if (language) free(language);
-	if (table) free(table);
+	if (hostname) ast_free(hostname);
+	if (dbname) ast_free(dbname);
+	if (dbuser) ast_free(dbuser);
+	if (password) ast_free(password);
+	if (charset) ast_free(charset);
+	if (language) ast_free(language);
+	if (table) ast_free(table);
 
 	return 0;
 }

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?view=diff&rev=67864&r1=67863&r2=67864
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Wed Jun  6 16:20:11 2007
@@ -378,7 +378,7 @@
 	if (p->dead) {
 		ast_mutex_destroy(&p->lock);
 		ast_mutex_destroy(&p->app_lock);
-		free(p);
+		ast_free(p);
         }
 	return 0;
 }
@@ -810,7 +810,7 @@
 	} else if (p->dead) {
 		ast_mutex_destroy(&p->lock);
 		ast_mutex_destroy(&p->app_lock);
-		free(p);
+		ast_free(p);
 	} else {
 		if (p->chan) {
 			/* Not dead -- check availability now */
@@ -1136,7 +1136,7 @@
 				if (!p->chan) {
 					ast_mutex_destroy(&p->lock);
 					ast_mutex_destroy(&p->app_lock);
-					free(p);
+					ast_free(p);
 				} else {
 					/* Cause them to hang up */
 					ast_softhangup(p->chan, AST_SOFTHANGUP_EXPLICIT);
@@ -2118,7 +2118,7 @@
 						if (p->dead && !p->owner) {
 							ast_mutex_destroy(&p->lock);
 							ast_mutex_destroy(&p->app_lock);
-							free(p);
+							ast_free(p);
 						}
 					}
 					else {

[... 10999 lines stripped ...]


More information about the asterisk-commits mailing list