[asterisk-commits] branch oej/sipdiversion r9100 - in /team/oej/sipdiversion: ./ channels/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 2 12:40:18 MST 2006


Author: oej
Date: Thu Feb  2 13:40:12 2006
New Revision: 9100

URL: http://svn.digium.com/view/asterisk?rev=9100&view=rev
Log:
Merged revisions 9071-9072,9085,9087-9088 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r9071 | mattf | 2006-02-02 17:09:01 +0100 (Thu, 02 Feb 2006) | 2 lines

Fix for very unlikely memory leak in res_odbc

................
r9072 | mattf | 2006-02-02 17:09:38 +0100 (Thu, 02 Feb 2006) | 2 lines

Fix so that hardhdlc works w/ chan_zap

................
r9085 | mattf | 2006-02-02 19:33:23 +0100 (Thu, 02 Feb 2006) | 2 lines

More stringfield related changes

................
r9087 | kpfleming | 2006-02-02 19:40:06 +0100 (Thu, 02 Feb 2006) | 2 lines

block patch that has already been merged

................
r9088 | kpfleming | 2006-02-02 19:40:22 +0100 (Thu, 02 Feb 2006) | 10 lines

Merged revisions 9086 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r9086 | kpfleming | 2006-02-02 12:37:04 -0600 (Thu, 02 Feb 2006) | 2 lines

don't override ASTERISKVERSIONNUM to 000000 for non-svn builds

........

................

Modified:
    team/oej/sipdiversion/   (props changed)
    team/oej/sipdiversion/Makefile
    team/oej/sipdiversion/channels/chan_misdn.c
    team/oej/sipdiversion/channels/chan_nbs.c
    team/oej/sipdiversion/channels/chan_zap.c
    team/oej/sipdiversion/res/res_odbc.c

Propchange: team/oej/sipdiversion/
------------------------------------------------------------------------------
--- svnmerge-blocked (original)
+++ svnmerge-blocked Thu Feb  2 13:40:12 2006
@@ -1,1 +1,1 @@
-/branches/1.2:7490,7497,7517,7529,7546,7550,7552,7557,7580,7586,7595,7605,7641,7663,7706,7738,7771,7792,7812,7870-7871,7898-7900,7915,7960,7965,7970,7976,8047,8112,8124,8134,8394,8412,8414,8418,8429,8433,8445,8562,8573,8600,8619,8666,8808
+/branches/1.2:7490,7497,7517,7529,7546,7550,7552,7557,7580,7586,7595,7605,7641,7663,7706,7738,7771,7792,7812,7870-7871,7898-7900,7915,7960,7965,7970,7976,8047,8112,8124,8134,8394,8412,8414,8418,8429,8433,8445,8562,8573,8600,8619,8666,8808,9073

Propchange: team/oej/sipdiversion/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb  2 13:40:12 2006
@@ -1,1 +1,1 @@
-/trunk:1-9069
+/trunk:1-9099

Modified: team/oej/sipdiversion/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/Makefile?rev=9100&r1=9099&r2=9100&view=diff
==============================================================================
--- team/oej/sipdiversion/Makefile (original)
+++ team/oej/sipdiversion/Makefile Thu Feb  2 13:40:12 2006
@@ -327,8 +327,6 @@
   ifneq ($(wildcard .svn),)
     ASTERISKVERSIONNUM=999999
     ASTERISKVERSION=SVN-$(shell build_tools/make_svn_branch_name)
-  else
-    ASTERISKVERSIONNUM=000000
   endif
 endif
 

Modified: team/oej/sipdiversion/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/channels/chan_misdn.c?rev=9100&r1=9099&r2=9100&view=diff
==============================================================================
--- team/oej/sipdiversion/channels/chan_misdn.c (original)
+++ team/oej/sipdiversion/channels/chan_misdn.c Thu Feb  2 13:40:12 2006
@@ -58,6 +58,7 @@
 #include <asterisk/indications.h>
 #include <asterisk/app.h>
 #include <asterisk/features.h>
+#include <asterisk/stringfields.h>
 
 #include "chan_misdn_config.h"
 #include "isdn_lib.h"
@@ -1081,15 +1082,12 @@
 	
 
 	misdn_cfg_get( port, MISDN_CFG_LANGUAGE, lang, BUFFERSIZE);
-	ast_copy_string(ast->language, lang, sizeof(ast->language));
-	ast->language[sizeof(ast->language)]=0;
-
-
-	char musicclass[BUFFERSIZE];
-	
-	misdn_cfg_get( port, MISDN_CFG_MUSICCLASS, musicclass, BUFFERSIZE);
-	ast_copy_string(ast->musicclass, musicclass, sizeof(ast->musicclass));
-	ast->musicclass[sizeof(ast->musicclass)]=0;
+	ast_string_field_set(ast, language, lang);
+
+	char localmusicclass[BUFFERSIZE];
+	
+	misdn_cfg_get( port, MISDN_CFG_MUSICCLASS, localmusicclass, BUFFERSIZE);
+	ast_string_field_set(ast, musicclass, localmusicclass);
 	
 	
 	misdn_cfg_get( port, MISDN_CFG_TXGAIN, &bc->txgain, sizeof(int));
@@ -2314,14 +2312,12 @@
 		
 		if (c<=0) {
 			c=glob_channel++;
-			snprintf(tmp->name, sizeof(tmp->name), "%s/%d-u%d",
+			ast_string_field_build(tmp, name, "%s/%d-u%d",
 				 misdn_type, port, c);
 		} else {
-			snprintf(tmp->name, sizeof(tmp->name), "%s/%d-%d",
+			ast_string_field_build(tmp, name, "%s/%d-%d",
 				 misdn_type, port, c);
 		}
-		
-		tmp->type = misdn_type;
 		
 		tmp->nativeformats = prefformat;
 

Modified: team/oej/sipdiversion/channels/chan_nbs.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/channels/chan_nbs.c?rev=9100&r1=9099&r2=9100&view=diff
==============================================================================
--- team/oej/sipdiversion/channels/chan_nbs.c (original)
+++ team/oej/sipdiversion/channels/chan_nbs.c Thu Feb  2 13:40:12 2006
@@ -51,7 +51,6 @@
 #include "asterisk/utils.h"
 
 static const char desc[] = "Network Broadcast Sound Support";
-static const char type[] = "NBS";
 static const char tdesc[] = "Network Broadcast Sound Driver";
 
 static int usecnt =0;
@@ -62,6 +61,7 @@
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
 
 static char context[AST_MAX_EXTENSION] = "default";
+static char type[] = "NBS";
 
 /* NBS creates private structures on demand */
    
@@ -233,8 +233,7 @@
 	tmp = ast_channel_alloc(1);
 	if (tmp) {
 		tmp->tech = &nbs_tech;
-		snprintf(tmp->name, sizeof(tmp->name), "NBS/%s", i->stream);
-		tmp->type = type;
+		ast_string_field_build(tmp, name, "NBS/%s", i->stream);
 		tmp->fds[0] = nbs_fd(i->nbs);
 		tmp->nativeformats = prefformat;
 		tmp->rawreadformat = prefformat;
@@ -247,7 +246,7 @@
 		tmp->tech_pvt = i;
 		strncpy(tmp->context, context, sizeof(tmp->context)-1);
 		strncpy(tmp->exten, "s",  sizeof(tmp->exten) - 1);
-		tmp->language[0] = '\0';
+		ast_string_field_set(tmp, language, "");
 		i->owner = tmp;
 		ast_mutex_lock(&usecnt_lock);
 		usecnt++;

Modified: team/oej/sipdiversion/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/channels/chan_zap.c?rev=9100&r1=9099&r2=9100&view=diff
==============================================================================
--- team/oej/sipdiversion/channels/chan_zap.c (original)
+++ team/oej/sipdiversion/channels/chan_zap.c Thu Feb  2 13:40:12 2006
@@ -9240,7 +9240,7 @@
 			ast_log(LOG_ERROR, "Unable to get parameters for D-channel %d (%s)\n", x, strerror(errno));
 			return -1;
 		}
-		if (p.sigtype != ZT_SIG_HDLCFCS) {
+		if ((p.sigtype != ZT_SIG_HDLCFCS) && (p.sigtype != ZT_SIG_HARDHDLC)) {
 			zt_close(pri->fds[i]);
 			pri->fds[i] = -1;
 			ast_log(LOG_ERROR, "D-channel %d is not in HDLC/FCS mode.  See /etc/zaptel.conf\n", x);

Modified: team/oej/sipdiversion/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipdiversion/res/res_odbc.c?rev=9100&r1=9099&r2=9100&view=diff
==============================================================================
--- team/oej/sipdiversion/res/res_odbc.c (original)
+++ team/oej/sipdiversion/res/res_odbc.c Thu Feb  2 13:40:12 2006
@@ -430,39 +430,41 @@
 {
 	static odbc_obj *new;
 
-	new = malloc(sizeof(odbc_obj));
-	if (!new)
-		return NULL;
-	memset(new, 0, sizeof(odbc_obj));
-	new->env = SQL_NULL_HANDLE;
-
-	new->name = malloc(strlen(name) + 1);
-	if (new->name == NULL)
-		return NULL;
-
-	new->dsn = malloc(strlen(dsn) + 1);
-	if (new->dsn == NULL)
-		return NULL;
+	if (!(new = calloc(1, sizeof(*new))) || 
+	    !(new->name = malloc(strlen(name) + 1)) || 
+	    !(new->dsn = malloc(strlen(dsn) + 1)))
+	    	goto cleanup;
 
 	if (username) {
-		new->username = malloc(strlen(username) + 1);
-		if (new->username == NULL)
-			return NULL;
+		if (!(new->username = malloc(strlen(username) + 1)))
+			goto cleanup;
 		strcpy(new->username, username);
 	}
 
 	if (password) {
-		new->password = malloc(strlen(password) + 1);
-		if (new->password == NULL)
-			return NULL;
+		if (!(new->password = malloc(strlen(password) + 1)))
+			goto cleanup;
 		strcpy(new->password, password);
 	}
 
 	strcpy(new->name, name);
 	strcpy(new->dsn, dsn);
+	new->env = SQL_NULL_HANDLE;
 	new->up = 0;
 	ast_mutex_init(&new->lock);
 	return new;
+
+cleanup:
+	if (new) {
+		free(new->name);
+		free(new->dsn);
+		free(new->username);
+		free(new->password);
+
+		free(new);	
+	}
+
+	return NULL;
 }
 
 void destroy_odbc_obj(odbc_obj **obj)



More information about the asterisk-commits mailing list