cdr.c: Add missing aow_unlock(cdr) in off nominal path of handle_dial_message().
authorRichard Mudgett <rmudgett@digium.com>
Thu, 13 Mar 2014 21:27:15 +0000 (21:27 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 13 Mar 2014 21:27:15 +0000 (21:27 +0000)
* Trivial common code hoisting in handle_bridge_leave_message().

* Some whitespace fixing.
........

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

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

main/cdr.c

index c15da10..e1060a5 100644 (file)
@@ -1973,6 +1973,7 @@ static void handle_dial_message(void *data, struct stasis_subscription *sub, str
 
                new_cdr = cdr_object_create_and_append(cdr);
                if (!new_cdr) {
+                       ao2_unlock(cdr);
                        return;
                }
                new_cdr->fn_table->process_dial_begin(new_cdr,
@@ -2217,7 +2218,6 @@ static void handle_bridge_leave_message(void *data, struct stasis_subscription *
        /* Party A */
        ao2_lock(cdr);
        for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
-
                if (!it_cdr->fn_table->process_bridge_leave) {
                        continue;
                }
@@ -2228,11 +2228,10 @@ static void handle_bridge_leave_message(void *data, struct stasis_subscription *
                        left_bridge = 1;
                }
        }
+       ao2_unlock(cdr);
        if (!left_bridge) {
-               ao2_unlock(cdr);
                return;
        }
-       ao2_unlock(cdr);
 
        if (strcmp(bridge->subclass, "parking")) {
                /* Party B */
@@ -2436,10 +2435,10 @@ static void handle_standard_bridge_enter_message(struct cdr_object *cdr,
                                if (!handled_cdr) {
                                        handled_cdr = it_cdr;
                                }
-                       break;
+                               break;
                        case BRIDGE_ENTER_NEED_CDR:
                                /* Pass */
-                       break;
+                               break;
                        case BRIDGE_ENTER_NO_PARTY_B:
                                /* We didn't win on any - end this CDR. If someone else comes in later
                                 * that is Party B to this CDR, it can re-activate this CDR.
@@ -2448,7 +2447,7 @@ static void handle_standard_bridge_enter_message(struct cdr_object *cdr,
                                        handled_cdr = it_cdr;
                                }
                                cdr_object_finalize(cdr);
-                       break;
+                               break;
                        }
                }
        }
@@ -3355,6 +3354,7 @@ int ast_cdr_fork(const char *channel_name, struct ast_flags *options)
 
        {
                SCOPED_AO2LOCK(lock, cdr);
+
                cdr_obj = cdr->last;
                if (cdr_obj->fn_table == &finalized_state_fn_table) {
                        /* If the last CDR in the chain is finalized, don't allow a fork -