[asterisk-commits] rmudgett: branch 1.6.0 r222800 - in /branches/1.6.0: ./ channels/misdn_config.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 8 11:47:24 CDT 2009
Author: rmudgett
Date: Thu Oct 8 11:47:21 2009
New Revision: 222800
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222800
Log:
Merged revisions 222799 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r222799 | rmudgett | 2009-10-08 11:44:33 -0500 (Thu, 08 Oct 2009) | 19 lines
Merged revisions 222797 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r222797 | rmudgett | 2009-10-08 11:33:06 -0500 (Thu, 08 Oct 2009) | 12 lines
Fix memory leak if chan_misdn config parameter is repeated.
Memory leak when the same config option is set more than once in an
misdn.conf section. Why must this be considered? Templates! Defining a
template with default port options and later adding to or overriding some
of them.
Patches:
memleak-misdn.patch
JIRA ABE-1998
........
................
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/channels/misdn_config.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/channels/misdn_config.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/channels/misdn_config.c?view=diff&rev=222800&r1=222799&r2=222800
==============================================================================
--- branches/1.6.0/channels/misdn_config.c (original)
+++ branches/1.6.0/channels/misdn_config.c Thu Oct 8 11:47:21 2009
@@ -878,6 +878,9 @@
switch (type) {
case MISDN_CTYPE_STR:
+ if (dest->str) {
+ ast_free(dest->str);
+ }
if ((len = strlen(value))) {
dest->str = ast_malloc((len + 1) * sizeof(char));
strncpy(dest->str, value, len);
@@ -897,18 +900,24 @@
res = sscanf(value, "%30d", &tmp);
}
if (res) {
- dest->num = ast_malloc(sizeof(int));
+ if (!dest->num) {
+ dest->num = ast_malloc(sizeof(int));
+ }
memcpy(dest->num, &tmp, sizeof(int));
} else
re = -1;
}
break;
case MISDN_CTYPE_BOOL:
- dest->num = ast_malloc(sizeof(int));
+ if (!dest->num) {
+ dest->num = ast_malloc(sizeof(int));
+ }
*(dest->num) = (ast_true(value) ? 1 : 0);
break;
case MISDN_CTYPE_BOOLINT:
- dest->num = ast_malloc(sizeof(int));
+ if (!dest->num) {
+ dest->num = ast_malloc(sizeof(int));
+ }
if (sscanf(value, "%30d", &tmp)) {
memcpy(dest->num, &tmp, sizeof(int));
} else {
@@ -927,7 +936,9 @@
}
break;
case MISDN_CTYPE_ASTGROUP:
- dest->grp = ast_malloc(sizeof(ast_group_t));
+ if (!dest->grp) {
+ dest->grp = ast_malloc(sizeof(ast_group_t));
+ }
*(dest->grp) = ast_get_group(value);
break;
}
More information about the asterisk-commits
mailing list