浏览代码

app_python: fix of buf memory allocation size for chars

Daniel-Constantin Mierla 9 年之前
父节点
当前提交
5042f30973
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      modules/app_python/python_support.c

+ 2 - 2
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);