Skip to content

Commit f1c5782

Browse files
committed
free outbuf on error
1 parent eab61bf commit f1c5782

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Modules/timemodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,8 @@ time_strftime1(time_char **outbuf, size_t *bufsize,
823823
time_char *tmp = (time_char *)PyMem_Realloc(*outbuf,
824824
*bufsize*sizeof(time_char));
825825
if (tmp == NULL) {
826+
PyMem_Free(*outbuf);
827+
*outbuf = NULL;
826828
PyErr_NoMemory();
827829
return NULL;
828830
}

0 commit comments

Comments
 (0)