Don't attempt to link in an aggregate MWI subscription if an endpoint does not aggreg...
authorMark Michelson <mmichelson@digium.com>
Thu, 6 Mar 2014 15:58:13 +0000 (15:58 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 6 Mar 2014 15:58:13 +0000 (15:58 +0000)
Attempting to link a NULL object into an ao2 container had been benign previously, but since
enabling DO_CRASH in the testsuite, this is now causing a crash. It's better to be right
here anyway.
........

Merged revisions 410011 from http://svn.asterisk.org/svn/asterisk/branches/12

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

res/res_pjsip_mwi.c

index 4a664c8..6856a70 100644 (file)
@@ -755,7 +755,9 @@ static int create_mwi_subscriptions_for_endpoint(void *obj, void *arg, int flags
                        ao2_cleanup(sub);
                }
        }
-       ao2_link(mwi_subscriptions, aggregate_sub);
+       if (aggregate_sub) {
+               ao2_link(mwi_subscriptions, aggregate_sub);
+       }
        return 0;
 }