ast_strdup failures aren't really failures if the original value was NULL.
authorMark Michelson <mmichelson@digium.com>
Fri, 10 Apr 2009 16:26:48 +0000 (16:26 +0000)
committerMark Michelson <mmichelson@digium.com>
Fri, 10 Apr 2009 16:26:48 +0000 (16:26 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187714 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_local.c

index 509e69b..89a77d8 100644 (file)
@@ -566,13 +566,17 @@ start_over:
         * All these failure points just return -1. The individual strings will
         * be cleared when we destroy the channel.
         */
-       if (!(p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis))) {
-               return -1;
+       if (p->owner->cid.cid_rdnis) {
+               if (!(p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis))) {
+                       return -1;
+               }
        }
        ast_party_redirecting_copy(&p->chan->redirecting, &p->owner->redirecting);
 
-       if (!(p->chan->cid.cid_dnid = ast_strdup(p->owner->cid.cid_dnid))) {
-               return -1;
+       if (p->owner->cid.cid_dnid) {
+               if (!(p->chan->cid.cid_dnid = ast_strdup(p->owner->cid.cid_dnid))) {
+                       return -1;
+               }
        }
        p->chan->cid.cid_tns = p->owner->cid.cid_tns;