]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
(closes issue #10437)
authorJoshua Colp <jcolp@digium.com>
Mon, 13 Aug 2007 14:18:04 +0000 (14:18 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 13 Aug 2007 14:18:04 +0000 (14:18 +0000)
Reported by: haklin
Don't set the callerid name and number a second time on a newly created channel. ast_channel_alloc itself already sets it and setting it twice would cause a memory leak.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79174 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_gtalk.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_local.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_zap.c

index 75b766a724ccc55879c534dfaf94b53592e55136..1e13521fd14b88f1aa8a8054572351e2dc31a59d 100644 (file)
@@ -973,9 +973,7 @@ static struct ast_channel *gtalk_new(struct gtalk *client, struct gtalk_pvt *i,
                cid = data;
        }
        cid = strsep(&cid, "@");
-       tmp->cid.cid_num = ast_strdup(cid);
        tmp->cid.cid_ani = ast_strdup(cid);
-       tmp->cid.cid_name = ast_strdup(i->them);
        if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
                tmp->cid.cid_dnid = ast_strdup(i->exten);
        tmp->priority = 1;
index c13ede3c38c51b70edf28dc7eae6163601566c4d..d519664edf607790896b2e5fd1ba24c1d1477be7 100644 (file)
@@ -1069,9 +1069,7 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
 
                /* Don't use ast_set_callerid() here because it will
                 * generate a needless NewCallerID event */
-               ch->cid.cid_num = ast_strdup(cid_num);
                ch->cid.cid_ani = ast_strdup(cid_num);
-               ch->cid.cid_name = ast_strdup(cid_name);
 
                if (pvt->cd.redirect_reason >= 0) {
                        ch->cid.cid_rdnis = ast_strdup(pvt->cd.redirect_number);
index 1c5cbf8ea652a83a821dcc527bac08a32ca88bf1..492a45782ac23895fcd6ecb12b9cc0ebefbc1cec 100644 (file)
@@ -3368,8 +3368,6 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
 
        /* Don't use ast_set_callerid() here because it will
         * generate a NewCallerID event before the NewChannel event */
-       tmp->cid.cid_num = ast_strdup(i->cid_num);
-       tmp->cid.cid_name = ast_strdup(i->cid_name);
        if (!ast_strlen_zero(i->ani))
                tmp->cid.cid_ani = ast_strdup(i->ani);
        else
index 6b9ca55b66799657f26ef40f688d68afe2c38905..4990d0fe1cee982e00946d8568ecd2f712bec874 100644 (file)
@@ -443,8 +443,6 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout)
        
        ast_mutex_lock(&p->lock);
 
-       p->chan->cid.cid_num = ast_strdup(p->owner->cid.cid_num);
-       p->chan->cid.cid_name = ast_strdup(p->owner->cid.cid_name);
        p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
        p->chan->cid.cid_ani = ast_strdup(p->owner->cid.cid_ani);
        p->chan->cid.cid_pres = p->owner->cid.cid_pres;
index 50203a15ed5d31db897e5f075c6ece975eae8247..bfcb3e8b440e1b93f7efe3e07732a8d37107649b 100644 (file)
@@ -1469,9 +1469,7 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
 
                /* Don't use ast_set_callerid() here because it will
                 * generate a needless NewCallerID event */
-               tmp->cid.cid_num = ast_strdup(i->cid_num);
                tmp->cid.cid_ani = ast_strdup(i->cid_num);
-               tmp->cid.cid_name = ast_strdup(i->cid_name);
                
                if (!i->adsi)
                        tmp->adsicpe = AST_ADSI_UNAVAILABLE;
index 0c6c25c9a5b5e3f323ef55a1d7100bb5a9a6b467..0c49a0bf4aa477cfe80db309835ffb4124ede4b1 100644 (file)
@@ -3335,16 +3335,10 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state,  char
                else
                        chan_misdn_log(1,0,"misdn_new: no exten given.\n");
                
-               if (callerid) {
-                       char *cid_name, *cid_num;
-      
-                       ast_callerid_parse(callerid, &cid_name, &cid_num);
+               if (callerid)
                        /* Don't use ast_set_callerid() here because it will
                         * generate a needless NewCallerID event */
-                       tmp->cid.cid_num = ast_strdup(cid_num);
                        tmp->cid.cid_ani = ast_strdup(cid_num);
-                       tmp->cid.cid_name = ast_strdup(cid_name);
-               }
 
                {
                        if (pipe(chlist->pipe)<0)
index e136bb2085e846d6d91664045b13346828a42a1c..7b3c8875173960a6c5687e3e08e62ebb60b5d1d4 100644 (file)
@@ -1008,9 +1008,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx,
                ast_string_field_set(c, language, o->language);
        /* Don't use ast_set_callerid() here because it will
         * generate a needless NewCallerID event */
-       c->cid.cid_num = ast_strdup(o->cid_num);
        c->cid.cid_ani = ast_strdup(o->cid_num);
-       c->cid.cid_name = ast_strdup(o->cid_name);
        if (!ast_strlen_zero(ext))
                c->cid.cid_dnid = ast_strdup(ext);
 
index ae2b8aba2b1aaa3ab9cf5d93a6c07fadcf8a20f9..9ef4619a737924e8db941b06b0f8d18b520c2481 100644 (file)
@@ -867,9 +867,7 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
 
                /* Don't use ast_set_callerid() here because it will
                 * generate a NewCallerID event before the NewChannel event */
-               tmp->cid.cid_num = ast_strdup(i->cid_num);
                tmp->cid.cid_ani = ast_strdup(i->cid_num);
-               tmp->cid.cid_name = ast_strdup(i->cid_name);
 
                i->owner = tmp;
                ast_module_ref(ast_module_info->self);
index f216d1cc41a18763f25a60a258c21622a41a1947..4eeea9fd863caa058615b257ea8743b1793e07d9 100644 (file)
@@ -3992,9 +3992,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
 
        /* Don't use ast_set_callerid() here because it will
         * generate an unnecessary NewCallerID event  */
-       tmp->cid.cid_num = ast_strdup(i->cid_num);
        tmp->cid.cid_ani = ast_strdup(i->cid_num);
-       tmp->cid.cid_name = ast_strdup(i->cid_name);
        if (!ast_strlen_zero(i->rdnis))
                tmp->cid.cid_rdnis = ast_strdup(i->rdnis);
        
index 3bbc1bae2823a91230af8dffa1efa2c527407dad..60566c48550a1a7c4a6aae014166197109bfd58c 100644 (file)
@@ -2863,9 +2863,7 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state)
 
                /* Don't use ast_set_callerid() here because it will
                 * generate a needless NewCallerID event */
-               tmp->cid.cid_num = ast_strdup(l->cid_num);
                tmp->cid.cid_ani = ast_strdup(l->cid_num);
-               tmp->cid.cid_name = ast_strdup(l->cid_name);
 
                tmp->priority = 1;
                tmp->adsicpe = AST_ADSI_UNAVAILABLE;
index d6d16de6e71d6afc82877e407db5464cd1946e49..d20596dbd786b0a5bb2c59e2940ced56a2be2212 100644 (file)
@@ -5317,16 +5317,12 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
        /* Don't use ast_set_callerid() here because it will
         * generate a needless NewCallerID event */
 #ifdef PRI_ANI
-       tmp->cid.cid_num = ast_strdup(i->cid_num);
-       tmp->cid.cid_name = ast_strdup(i->cid_name);
        if (!ast_strlen_zero(i->cid_ani))
                tmp->cid.cid_ani = ast_strdup(i->cid_ani);
        else    
                tmp->cid.cid_ani = ast_strdup(i->cid_num);
 #else
-       tmp->cid.cid_num = ast_strdup(i->cid_num);
        tmp->cid.cid_ani = ast_strdup(i->cid_num);
-       tmp->cid.cid_name = ast_strdup(i->cid_name);
 #endif
        tmp->cid.cid_pres = i->callingpres;
        tmp->cid.cid_ton = i->cid_ton;