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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2016-11-01T18:11:17+01:00

app_python: adjusted the realloc size to char pointers

---

Modified: modules/app_python/python_support.c

---

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

---

diff --git a/modules/app_python/python_support.c 
b/modules/app_python/python_support.c
index 28f92da..47b4640 100644
--- a/modules/app_python/python_support.c
+++ b/modules/app_python/python_support.c
@@ -184,14 +184,14 @@ char *make_message(const char *fmt, ...)
        va_list ap;
 
        size = 100;     /* Guess we need no more than 100 bytes. */
-       p = (char *)pkg_realloc(NULL, size * sizeof(char *));
+       p = (char *)pkg_realloc(NULL, size * sizeof(char));
        if (!p)
        {
                LM_ERR("Can't allocate memory (%lu bytes), pkg_malloc() has 
failed:"
-                               " Not enough memory.\n", (unsigned long)(size * 
sizeof(char *)));
+                               " Not enough memory.\n", (unsigned long)(size * 
sizeof(char)));
                return NULL;
        }
-       memset(p, 0, size * sizeof(char *));
+       memset(p, 0, size * sizeof(char));
 
        while (1)
        {
@@ -207,11 +207,11 @@ char *make_message(const char *fmt, ...)
                else           /* glibc 2.0 */
                        size *= 2;
 
-               np = (char *)pkg_realloc(p, size * sizeof(char *));
+               np = (char *)pkg_realloc(p, size * sizeof(char));
                if (!np)
                {
                        LM_ERR("Can't allocate memory (%lu bytes), 
pkg_realloc() has failed:"
-                                       " Not enough memory.\n", (unsigned 
long)size * sizeof(char *));
+                                       " Not enough memory.\n", (unsigned 
long)size * sizeof(char));
                        if (p)
                                pkg_free(p);
                        return NULL;


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to