Module: kamailio
Branch: master
Commit: 2a80448b07b39dece0770bd04014a12e2d0390d8
URL:
https://github.com/kamailio/kamailio/commit/2a80448b07b39dece0770bd04014a12…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-08-10T10:55:07+02:00
xprint: use pkg_reallocxf() to ensure old pointer is freed in case of failure
- fix also potential free of null
---
Modified: src/modules/xprint/xp_lib.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2a80448b07b39dece0770bd04014a12…
Patch:
https://github.com/kamailio/kamailio/commit/2a80448b07b39dece0770bd04014a12…
---
diff --git a/src/modules/xprint/xp_lib.c b/src/modules/xprint/xp_lib.c
index d68bd64c05..068608a304 100644
--- a/src/modules/xprint/xp_lib.c
+++ b/src/modules/xprint/xp_lib.c
@@ -1862,9 +1862,8 @@ int xl_mod_init()
str_domainname.s = NULL;
} else {
str_fullname.len = strlen(s);
- s = pkg_realloc(s, str_fullname.len+1); /* this will leave the ending \0 */
+ s = pkg_reallocxf(s, str_fullname.len+1); /* this will leave the ending \0 */
if (!s) { /* should never happen because decreasing size */
- pkg_free(s);
return -1;
}
str_fullname.s = s;