[sr-dev] git:master:5042f309: app_python: fix of buf memory allocation size for chars
Daniel-Constantin Mierla
miconda at gmail.com
Mon Apr 18 12:53:23 CEST 2016
Module: kamailio
Branch: master
Commit: 5042f309739460ad87dc9a064c43e602602da703
URL: https://github.com/kamailio/kamailio/commit/5042f309739460ad87dc9a064c43e602602da703
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-04-18T12:52:25+02:00
app_python: fix of buf memory allocation size for chars
---
Modified: modules/app_python/python_support.c
---
Diff: https://github.com/kamailio/kamailio/commit/5042f309739460ad87dc9a064c43e602602da703.diff
Patch: https://github.com/kamailio/kamailio/commit/5042f309739460ad87dc9a064c43e602602da703.patch
---
diff --git a/modules/app_python/python_support.c b/modules/app_python/python_support.c
index e52c5e6..7a60214 100644
--- a/modules/app_python/python_support.c
+++ b/modules/app_python/python_support.c
@@ -79,13 +79,13 @@ void python_handle_exception(const char *fmt, ...)
}
buflen = 1;
- buf = (char *)pkg_realloc(NULL, buflen * sizeof(char *));
+ buf = (char *)pkg_realloc(NULL, buflen * sizeof(char));
if (!buf)
{
LM_ERR("python_handle_exception(): Can't allocate memory (%lu bytes), pkg_realloc() has failed. Not enough memory.\n", (unsigned long)(buflen * sizeof(char *)));
return;
}
- memset(buf, 0, sizeof(char *));
+ memset(buf, 0, buflen * sizeof(char));
for (i = 0; i < PySequence_Size(pResult); i++) {
line = PySequence_GetItem(pResult, i);
More information about the sr-dev
mailing list