osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [osip-dev] inconsistencies in eXosip_insubscription_send_answer


From: Aymeric Moizard
Subject: Re: [osip-dev] inconsistencies in eXosip_insubscription_send_answer
Date: Thu, 20 Oct 2016 18:23:58 +0200

Hi Christoph!

Tks for the good catch. It's fixed and pushed in the git.

However, it's not going to happen much as "tid" should have
been correct right before when creating the SIP answer ;)

Tks a lot!
Aymeric

2016-10-20 12:57 GMT+02:00 FEICHTER Christoph <address@hidden>:

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

 




--
Antisip - http://www.antisip.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]