[sr-dev] git:master:609962b4: ims_registrar_pcscf: go to error to free variables on failure cases

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 10 13:02:40 CEST 2022


Module: kamailio
Branch: master
Commit: 609962b49a79dc5650f72470f4b03746d2e6db46
URL: https://github.com/kamailio/kamailio/commit/609962b49a79dc5650f72470f4b03746d2e6db46

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-10-10T13:01:21+02:00

ims_registrar_pcscf: go to error to free variables on failure cases

---

Modified: src/modules/ims_registrar_pcscf/ul_callback.c

---

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

---

diff --git a/src/modules/ims_registrar_pcscf/ul_callback.c b/src/modules/ims_registrar_pcscf/ul_callback.c
index 57b89da3e18..320714f8b1c 100644
--- a/src/modules/ims_registrar_pcscf/ul_callback.c
+++ b/src/modules/ims_registrar_pcscf/ul_callback.c
@@ -92,13 +92,13 @@ str* build_reginfo_partial(ppublic_t *impu, struct pcontact* c, int type) {
 	doc = xmlNewDoc(BAD_CAST "1.0");
 	if (doc == 0) {
 		LM_ERR("Unable to create XML-Doc\n");
-		return NULL;
+		goto error;
 	}
 
 	root_node = xmlNewNode(NULL, BAD_CAST "reginfo");
 	if (root_node == 0) {
 		LM_ERR("Unable to create reginfo-XML-Element\n");
-		return NULL;
+		goto error;
 	}
 	/* This is our Root-Element: */
 	xmlDocSetRootElement(doc, root_node);
@@ -157,7 +157,7 @@ str* build_reginfo_partial(ppublic_t *impu, struct pcontact* c, int type) {
 	body = (str*) pkg_malloc(sizeof(str));
 	if (body == NULL) {
 		LM_ERR("while allocating memory\n");
-		return NULL;
+		goto error;
 	}
 	memset(body, 0, sizeof(str));
 




More information about the sr-dev mailing list