فهرست منبع

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;
 	buflen = 1;
-	buf = (char *)pkg_realloc(NULL, buflen * sizeof(char *));
+	buf = (char *)pkg_realloc(NULL, buflen * sizeof(char));
 	if (!buf)
 	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 *)));
 		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;
 		return;
 	}
 	}
-	memset(buf, 0, sizeof(char *));
+	memset(buf, 0, buflen * sizeof(char));
 
 
 	for (i = 0; i < PySequence_Size(pResult); i++) {
 	for (i = 0; i < PySequence_Size(pResult); i++) {
 		line = PySequence_GetItem(pResult, i);
 		line = PySequence_GetItem(pResult, i);