Skip to content

Commit b2dd86d

Browse files
committed
PyOS_vsnprintf(): Change PyMem_Malloc() call to PyMem_MALLOC() macro,
(ditto for PyMem_Free() -> PyMem_FREE()) to fix and close SF bug #495875 on systems that HAVE_SNPRINTF=0. Check in on both release-22 branch and trunk.
1 parent 3d2d980 commit b2dd86d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/mysnprintf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
6565
len = vsnprintf(str, size, format, va);
6666
#else
6767
/* Emulate it. */
68-
buffer = PyMem_Malloc(size + 512);
68+
buffer = PyMem_MALLOC(size + 512);
6969
if (buffer == NULL) {
7070
len = -666;
7171
goto Done;
@@ -85,7 +85,7 @@ PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
8585
memcpy(str, buffer, to_copy);
8686
str[to_copy] = '\0';
8787
}
88-
PyMem_Free(buffer);
88+
PyMem_FREE(buffer);
8989
Done:
9090
#endif
9191
str[size-1] = '\0';

0 commit comments

Comments
 (0)