Browse code

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)

Daniel-Constantin Mierla authored on 20/02/2017 18:24:36
Showing 1 changed files
... ...
@@ -323,7 +323,7 @@ void ul_publish(ucontact_t* c, int type, void* param)
323 323
 	print_publ(publ);
324 324
 	if((error=_pu_pua.send_publish(publ))< 0)
325 325
 	{
326
-		LM_ERR("while sending publish for ul event %d\n", type);
326
+		LM_ERR("failed sending publish for ul event %d\n", type);
327 327
 		if((type & UL_CONTACT_UPDATE) && error == ERR_PUBLISH_NO_BODY) {
328 328
 			/* This error can occur if Kamailio was restarted/stopped and for any reason couldn't store a pua
329 329
 			 * 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)
336 336
 			 * previous one expires), but this is a minor issue. */
337 337
 			LM_ERR("UPDATE action generated a PUBLISH without body -> invoking INSERT action\n");
338 338
 			ul_publish(c, UL_CONTACT_INSERT, param);
339
-			return;
339
+			goto error;
340 340
 		}
341 341
 	}
342 342
 
343
-	pua_ul_publish= 0;
344
-
345 343
 error:
346
-
344
+	pua_ul_publish = 0;
347 345
 	if(publ)
348 346
 		pkg_free(publ);
349 347
 
350
-	if(body)
351
-	{
348
+	if(body) {
352 349
 		if(body->s)
353 350
 			xmlFree(body->s);
354 351
 		pkg_free(body);
... ...
@@ -356,7 +353,6 @@ error:
356 353
 	
357 354
 	if(uri.s)
358 355
 		pkg_free(uri.s);
359
-	pua_ul_publish= 0;
360 356
 
361 357
 	return;
362 358