|
From: | Aymeric Moizard |
Subject: | Re: [osip-dev] inconsistencies in eXosip_insubscription_send_answer |
Date: | Thu, 20 Oct 2016 18:23:58 +0200 |
hi,
… and some inconsistencies in eXosip_insubscription_send_
answer. the function should cleanup osip_message_t * answer in all failure cases the same way:
int
eXosip_insubscription_send_
answer (struct eXosip_t *excontext, int tid, int status, osip_message_t * answer) {
int i = -1;
eXosip_dialog_t *jd = NULL;
eXosip_notify_t *jn = NULL;
osip_transaction_t *tr = NULL;
osip_event_t *evt_answer;
if (tid <= 0) {
osip_message_free (answer);
return OSIP_BADPARAMETER;
}
if (tid > 0) {
_eXosip_insubscription_
transaction_find (excontext, tid, &jn, &jd, &tr); }
if (jd == NULL || tr == NULL || tr->orig_request == NULL || tr->orig_request->sip_method == NULL) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No incoming subscription here?\n"));
osip_message_free (answer);
return OSIP_NOTFOUND;
}
if (answer == NULL) {
if (0 == osip_strcasecmp (tr->orig_request->sip_method, "SUBSCRIBE") || 0 == osip_strcasecmp (tr->orig_request->sip_method, "REFER")) {
if (status >= 200 && status <= 299) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: provide a prepared answer\n"));
return OSIP_BADPARAMETER;
}
}
}
further down in this function answer is freed,
using the same return value OSIP_BADPARAMETER.
br,
christoph
[Prev in Thread] | Current Thread | [Next in Thread] |