[Top][All Lists]

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

[osip-dev] memleak in function eXosip_call_get_referto

From: FEICHTER Christoph
Subject: [osip-dev] memleak in function eXosip_call_get_referto
Date: Fri, 27 Feb 2015 10:27:28 +0000

Hi aymeric,
we found a memleak.
After calling osip_uri_to_str the allocated memory is not freed:
eXcall_api.c, line 1447ff:
eXosip_call_get_referto (struct eXosip_t *excontext, int did, char *refer_to, size_t refer_to_len)
  eXosip_dialog_t *jd = NULL;
  eXosip_call_t *jc = NULL;
  osip_transaction_t *tr = NULL;
  osip_uri_t *referto_uri;
  char atmp[256];
  char *referto_tmp = NULL;
  int i;
  if (did <= 0)
  _eXosip_call_dialog_find (excontext, did, &jc, &jd);
  if (jc == NULL || jd == NULL || jd->d_dialog == NULL) {
    OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No call here?\n"));
    return OSIP_NOTFOUND;
  tr = _eXosip_find_last_invite (jc, jd);
  if (tr == NULL || tr->orig_request == NULL) {
    OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No transaction for call?\n"));
    return OSIP_NOTFOUND;
  i = osip_uri_clone (jd->d_dialog->remote_uri->url, &referto_uri);
  if (i != 0)
    return i;
  snprintf (atmp, sizeof (atmp), "%s;to-tag=%s;from-tag=%s", jd->d_dialog->call_id, jd->d_dialog->remote_tag, jd->d_dialog->local_tag);
  osip_uri_uheader_add (referto_uri, osip_strdup ("Replaces"), osip_strdup (atmp));
  i = osip_uri_to_str (referto_uri, &referto_tmp);
  if (i != 0) {
    osip_uri_free (referto_uri);
    osip_free (referto_tmp);
    return i;
  snprintf (refer_to, refer_to_len, "%s", referto_tmp);
  osip_uri_free (referto_uri);
  osip_free (referto_tmp);
  return OSIP_SUCCESS;

reply via email to

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