Module: kamailio
Branch: master
Commit: 5a1f80f266069dbc453b44a856f225c254e7c050
URL:
https://github.com/kamailio/kamailio/commit/5a1f80f266069dbc453b44a856f225c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-07-22T10:02:09+02:00
xprint: check to avoid double free
---
Modified: src/modules/xprint/xp_lib.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5a1f80f266069dbc453b44a856f225c…
Patch:
https://github.com/kamailio/kamailio/commit/5a1f80f266069dbc453b44a856f225c…
---
diff --git a/src/modules/xprint/xp_lib.c b/src/modules/xprint/xp_lib.c
index e4442ba87f4..b6fc5066556 100644
--- a/src/modules/xprint/xp_lib.c
+++ b/src/modules/xprint/xp_lib.c
@@ -1896,6 +1896,7 @@ int xl_mod_init()
str_ipaddr.s[str_ipaddr.len] = '\0';
} else {
pkg_free(s);
+ s = NULL;
str_ipaddr.len = 0;
PKG_MEM_ERROR_FMT("for str_ipaddr\n");
}
@@ -1914,7 +1915,8 @@ int xl_mod_init()
}
}
}
- pkg_free(s);
+ if(s != NULL)
+ pkg_free(s);
DBG("Hostname: %.*s\n", str_hostname.len, ZSW(str_hostname.s));
DBG("Domainname: %.*s\n", str_domainname.len, ZSW(str_domainname.s));