git:4.4:b79b94aa: pua_usrloc: free memory in case of failire in pua send_publish()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

git:4.4:b79b94aa: pua_usrloc: free memory in case of failire in pua send_publish()

Daniel-Constantin Mierla-6
Module: kamailio
Branch: 4.4
Commit: b79b94aa738325737e82b6485e78eeec2dbea7ac
URL: https://github.com/kamailio/kamailio/commit/b79b94aa738325737e82b6485e78eeec2dbea7ac

Author: Daniel-Constantin Mierla <[hidden email]>
Committer: Daniel-Constantin Mierla <[hidden email]>
Date: 2017-06-16T09:08:10+02:00

pua_usrloc: free memory in case of failire in pua send_publish()

- related to GH #1001

(cherry picked from commit 504699b6c2f34fbf7db02f57909eefdffc6b8180)
(cherry picked from commit e2e8f3e4e887e482dd9908c0c9fc5f85923def81)

---

Modified: modules/pua_usrloc/ul_publish.c

---

Diff:  https://github.com/kamailio/kamailio/commit/b79b94aa738325737e82b6485e78eeec2dbea7ac.diff
Patch: https://github.com/kamailio/kamailio/commit/b79b94aa738325737e82b6485e78eeec2dbea7ac.patch

---

diff --git a/modules/pua_usrloc/ul_publish.c b/modules/pua_usrloc/ul_publish.c
index beb5aa61bb..ab67d349d1 100644
--- a/modules/pua_usrloc/ul_publish.c
+++ b/modules/pua_usrloc/ul_publish.c
@@ -323,7 +323,7 @@ void ul_publish(ucontact_t* c, int type, void* param)
  print_publ(publ);
  if((error=_pu_pua.send_publish(publ))< 0)
  {
- LM_ERR("while sending publish for ul event %d\n", type);
+ LM_ERR("failed sending publish for ul event %d\n", type);
  if((type & UL_CONTACT_UPDATE) && error == ERR_PUBLISH_NO_BODY) {
  /* This error can occur if Kamailio was restarted/stopped and for any reason couldn't store a pua
  * entry in 'pua' DB table. It can also occur if 'pua' table is cleaned externally while Kamailio
@@ -336,19 +336,16 @@ void ul_publish(ucontact_t* c, int type, void* param)
  * previous one expires), but this is a minor issue. */
  LM_ERR("UPDATE action generated a PUBLISH without body -> invoking INSERT action\n");
  ul_publish(c, UL_CONTACT_INSERT, param);
- return;
+ goto error;
  }
  }
 
- pua_ul_publish= 0;
-
 error:
-
+ pua_ul_publish = 0;
  if(publ)
  pkg_free(publ);
 
- if(body)
- {
+ if(body) {
  if(body->s)
  xmlFree(body->s);
  pkg_free(body);
@@ -356,7 +353,6 @@ void ul_publish(ucontact_t* c, int type, void* param)
 
  if(uri.s)
  pkg_free(uri.s);
- pua_ul_publish= 0;
 
  return;
 


_______________________________________________
Kamailio (SER) - Development Mailing List
[hidden email]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev