Просмотр исходного кода

modules/ims_dialog: release lock in error conditions

jaybeepee 9 лет назад
Родитель
Сommit
51ba40fe57
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      modules/ims_dialog/dlg_hash.c

+ 2 - 0
modules/ims_dialog/dlg_hash.c

@@ -442,6 +442,7 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str *rr, str *contact,
                         dlg_out->callee_contact.s = (char*) shm_malloc(contact->len);
                         dlg_out->callee_contact.s = (char*) shm_malloc(contact->len);
                         if (!dlg_out->callee_contact.s) {
                         if (!dlg_out->callee_contact.s) {
                             LM_ERR("no more shm mem\n");
                             LM_ERR("no more shm mem\n");
+							lock_release(dlg->dlg_out_entries_lock);
                             return -1; //if we're out of mem we dont really care about cleaning up - prob going to crash anyway
                             return -1; //if we're out of mem we dont really care about cleaning up - prob going to crash anyway
                         }
                         }
                         dlg_out->callee_contact.len = contact->len;
                         dlg_out->callee_contact.len = contact->len;
@@ -461,6 +462,7 @@ int dlg_set_leg_info(struct dlg_cell *dlg, str* tag, str *rr, str *contact,
                         dlg_out->caller_cseq.s = (char*) shm_malloc(cseq->len);
                         dlg_out->caller_cseq.s = (char*) shm_malloc(cseq->len);
                         if (!dlg_out->callee_cseq.s || !dlg_out->caller_cseq.s) {
                         if (!dlg_out->callee_cseq.s || !dlg_out->caller_cseq.s) {
                             LM_ERR("no more shm mem\n");
                             LM_ERR("no more shm mem\n");
+							lock_release(dlg->dlg_out_entries_lock);
                             return -1; //if we're out of mem we dont really care about cleaning up - prob going to crash anyway
                             return -1; //if we're out of mem we dont really care about cleaning up - prob going to crash anyway
                         }
                         }
                         dlg_out->caller_cseq.len = cseq->len;
                         dlg_out->caller_cseq.len = cseq->len;