Skip to content

Commit a7671d8

Browse files
authored
Don't overallocate memory in attrs_from_List()
Allocate ``(strlen + 1) * sizeof(char)`` instead of ``(strlen + 1) * sizeof(char*)`` for a ``char[]`` in ``attrs_from_List()``. python-ldap#340 Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent 3c0f7ef commit a7671d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/LDAPObject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ attrs_from_List(PyObject *attrlist, char ***attrsp)
335335
* internal values that must be treated like const char. Python
336336
* 3.7 actually returns a const char.
337337
*/
338-
attrs[i] = (char *)PyMem_NEW(char *, strlen + 1);
338+
attrs[i] = (char *)PyMem_NEW(char, strlen + 1);
339339

340340
if (attrs[i] == NULL)
341341
goto nomem;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy