[asterisk-commits] russell: branch group/vldtmf_fixup r51208 - in /team/group/vldtmf_fixup: ./ c...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 17 16:37:30 MST 2007


Author: russell
Date: Wed Jan 17 17:37:29 2007
New Revision: 51208

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51208
Log:
Merged revisions 51204-51205 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r51204 | russell | 2007-01-17 16:09:52 -0600 (Wed, 17 Jan 2007) | 4 lines

Instead of dividing the offset by 2 directly, make it more clear that the
offset is being scaled by the size of the elements in the buffer.
(Inspired by a discussing on the asterisk-dev list about this code)

........
r51205 | russell | 2007-01-17 17:31:11 -0600 (Wed, 17 Jan 2007) | 5 lines

Fix some instances where when loading func_odbc, a double-free could occur.
Also, remove an unneeded error message.  If the failure condition is
actually a memory allocation failure, a log message will already be
generated automatically.

........

Modified:
    team/group/vldtmf_fixup/   (props changed)
    team/group/vldtmf_fixup/channels/chan_zap.c
    team/group/vldtmf_fixup/funcs/func_odbc.c

Propchange: team/group/vldtmf_fixup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 17 17:37:29 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-51200
+/branches/1.4:1-51207

Modified: team/group/vldtmf_fixup/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/group/vldtmf_fixup/channels/chan_zap.c?view=diff&rev=51208&r1=51207&r2=51208
==============================================================================
--- team/group/vldtmf_fixup/channels/chan_zap.c (original)
+++ team/group/vldtmf_fixup/channels/chan_zap.c Wed Jan 17 17:37:29 2007
@@ -4774,7 +4774,7 @@
 	p->subs[index].f.samples = READ_SIZE;
 	p->subs[index].f.mallocd = 0;
 	p->subs[index].f.offset = AST_FRIENDLY_OFFSET;
-	p->subs[index].f.data = p->subs[index].buffer + AST_FRIENDLY_OFFSET/2;
+	p->subs[index].f.data = p->subs[index].buffer + AST_FRIENDLY_OFFSET / sizeof(p->subs[index].buffer[0]);
 #if 0
 	ast_log(LOG_DEBUG, "Read %d of voice on %s\n", p->subs[index].f.datalen, ast->name);
 #endif	

Modified: team/group/vldtmf_fixup/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/group/vldtmf_fixup/funcs/func_odbc.c?view=diff&rev=51208&r1=51207&r2=51208
==============================================================================
--- team/group/vldtmf_fixup/funcs/func_odbc.c (original)
+++ team/group/vldtmf_fixup/funcs/func_odbc.c Wed Jan 17 17:37:29 2007
@@ -363,6 +363,8 @@
 	if ((tmp = ast_variable_retrieve(cfg, catg, "dsn"))) {
 		ast_copy_string((*query)->dsn, tmp, sizeof((*query)->dsn));
 	} else {
+		free(*query);
+		*query = NULL;
 		return -1;
 	}
 
@@ -384,6 +386,7 @@
 	(*query)->acf = ast_calloc(1, sizeof(struct ast_custom_function));
 	if (! (*query)->acf) {
 		free(*query);
+		*query = NULL;
 		return -1;
 	}
 
@@ -396,6 +399,7 @@
 	if (!((*query)->acf->name)) {
 		free((*query)->acf);
 		free(*query);
+		*query = NULL;
 		return -1;
 	}
 
@@ -405,6 +409,7 @@
 		free((char *)(*query)->acf->name);
 		free((*query)->acf);
 		free(*query);
+		*query = NULL;
 		return -1;
 	}
 
@@ -440,6 +445,7 @@
 		free((char *)(*query)->acf->name);
 		free((*query)->acf);
 		free(*query);
+		*query = NULL;
 		return -1;
 	}
 
@@ -496,7 +502,6 @@
 		struct acf_odbc_query *query = NULL;
 
 		if (init_acf_query(cfg, catg, &query)) {
-			ast_log(LOG_ERROR, "Out of memory\n");
 			free_acf_query(query);
 		} else {
 			AST_LIST_INSERT_HEAD(&queries, query, list);



More information about the asterisk-commits mailing list