/*! * \brief Free all memory used by the given structure * * Free all memory used by the given structure. * The structure must be removed from all linked * lists first * \param _r freed record list */ void free_impurecord(impurecord_t* _r) { ucontact_t* ptr; struct ul_callback *cbp, *cbp_tmp; struct _reg_subscriber* subscriber, *s_tmp; while (_r->contacts) { ptr = _r->contacts; _r->contacts = _r->contacts->next; free_ucontact(ptr); } //free IMS specific extensions if (_r->ccf1.s) shm_free(_r->ccf1.s); if (_r->ccf2.s) shm_free(_r->ccf2.s); if (_r->ecf1.s) shm_free(_r->ecf1.s); if (_r->ecf2.s) shm_free(_r->ecf2.s); if (_r->s) { LM_DBG("ref count on this IMS data is %d\n", _r->s->ref_count); lock_get(_r->s->lock); if (_r->s->ref_count == 1) { LM_DBG("freeing IMS subscription data\n"); free_ims_subscription_data(_r->s); } else { LM_DBG("decrementing IMS subscription data ref count\n"); _r->s->ref_count--; lock_release(_r->s->lock); } } /*remove REG subscriptions to this IMPU*/ subscriber = _r->shead; while (subscriber) { s_tmp = subscriber->next; free_subscriber(subscriber); subscriber = s_tmp; } if (_r->public_identity.s) shm_free(_r->public_identity.s); //free callback list for (cbp = _r->cbs->first; cbp;) { cbp_tmp = cbp; cbp = cbp->next; if (cbp_tmp->param) shm_free(cbp_tmp->param); shm_free(cbp_tmp); } shm_free(_r->cbs); shm_free(_r); }
/*! * \brief Remove contact in memory from the list and delete it * \param _r record this contact belongs to * \param _c deleted contact */ void mem_delete_ucontact(impurecord_t* _r, ucontact_t* _c) { struct contact_dialog_data *dialog_data; //tear down dialogs in dialog data list for (dialog_data = _c->first_dialog_data; dialog_data;) { dlgb.lookup_terminate_dlg(dialog_data->h_entry, dialog_data->h_id, NULL ); dialog_data = dialog_data->next; } mem_remove_ucontact(_r, _c); if_update_stat(_r->slot, _r->slot->d->contacts, -1); free_ucontact(_c); }
/* * Free all memory used by the given structure * The structure must be removed from all linked * lists first */ void free_urecord(urecord_t* _r) { ucontact_t* ptr; while(_r->contacts) { ptr = _r->contacts; _r->contacts = _r->contacts->next; free_ucontact(ptr); } if (_r->aor.s) shm_free(_r->aor.s); shm_free(_r); }
/*! * \brief Free all memory used by the given structure * * Free all memory used by the given structure. * The structure must be removed from all linked * lists first * \param _r freed record list */ void free_urecord(urecord_t* _r) { ucontact_t* ptr; while(_r->contacts) { ptr = _r->contacts; _r->contacts = _r->contacts->next; free_ucontact(ptr); } /* if mem cache is not used, the urecord struct is static*/ if (db_mode!=DB_ONLY) { if (_r->aor.s) shm_free(_r->aor.s); shm_free(_r); } }
/*! * \brief Remove contact in memory from the list and delete it * \param _r record this contact belongs to * \param _c deleted contact */ void mem_delete_ucontact(ucontact_t* _c) { struct contact_dialog_data *dialog_data; //tear down dialogs in dialog data list LM_DBG("Checking if dialog_data is there and needs to be torn down\n"); if(_c->first_dialog_data == 0) { LM_DBG("first dialog is 0!\n"); } else { LM_DBG("first dialog is not 0\n"); } for (dialog_data = _c->first_dialog_data; dialog_data;) { LM_DBG("Going to tear down dialog with info h_entry [%d] h_id [%d]\n", dialog_data->h_entry, dialog_data->h_id); dlgb.lookup_terminate_dlg(dialog_data->h_entry, dialog_data->h_id, NULL); dialog_data = dialog_data->next; } mem_remove_ucontact(_c); free_ucontact(_c); }
/* * Free all memory used by the given structure * The structure must be removed from all linked * lists first */ void free_urecord(urecord_t* _r) { notify_cb_t* watcher; ucontact_t* ptr; while(_r->watchers) { watcher = _r->watchers; _r->watchers = watcher->next; shm_free(watcher); } while(_r->contacts) { ptr = _r->contacts; _r->contacts = _r->contacts->next; free_ucontact(ptr); } if (_r->uid.s) shm_free(_r->uid.s); shm_free(_r); }
/* * Remove contact from the list and delete */ void mem_delete_ucontact(urecord_t* _r, ucontact_t* _c) { mem_remove_ucontact(_r, _c); free_ucontact(_c); }
/*! * \brief Remove contact in memory from the list and delete it * \param _r record this contact belongs to * \param _c deleted contact */ void mem_delete_ucontact(urecord_t* _r, ucontact_t* _c) { mem_remove_ucontact(_r, _c); if_update_stat( _r->slot, _r->slot->d->contacts, -1); free_ucontact(_c); }