[sr-dev] git:master:64d3d1de: app_python: fixed realloc size for local buf variables

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 1 15:37:48 CET 2016


Module: kamailio
Branch: master
Commit: 64d3d1de13666277e3b1bd707e05880e63fd6ccf
URL: https://github.com/kamailio/kamailio/commit/64d3d1de13666277e3b1bd707e05880e63fd6ccf

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-11-01T15:23:00+01:00

app_python: fixed realloc size for local buf variables

- removed unreachable code

---

Modified: modules/app_python/apy_kemi.c
Modified: modules/app_python/python_support.c

---

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

---

diff --git a/modules/app_python/apy_kemi.c b/modules/app_python/apy_kemi.c
index 431b0d9..fd4ed7f 100644
--- a/modules/app_python/apy_kemi.c
+++ b/modules/app_python/apy_kemi.c
@@ -542,8 +542,6 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx)
 					fname.len, fname.s);
 			return sr_kemi_apy_return_false();
 	}
-
-	return sr_kemi_apy_return_false();
 }
 
 /**
diff --git a/modules/app_python/python_support.c b/modules/app_python/python_support.c
index fd5a4a6..28f92da 100644
--- a/modules/app_python/python_support.c
+++ b/modules/app_python/python_support.c
@@ -114,7 +114,7 @@ void python_handle_exception(const char *fmt, ...)
 		msglen = strlen(msg);
 		buflen += ++msglen;
 
-		buf = (char *)pkg_realloc(buf, buflen * sizeof(char *));
+		buf = (char *)pkg_realloc(buf, buflen * sizeof(char));
 		if (!buf)
 		{
 			LM_ERR("Can't allocate memory (%lu bytes), pkg_realloc() has failed."




More information about the sr-dev mailing list