Issue #6986: Fix crash in the JSON C accelerator when called with the
[python.git] / Python / strdup.c
blob20187e0f0a7571f26f97df79b1da40716076c441
1 /* strdup() replacement (from stdwin, if you must know) */
3 #include "pgenheaders.h"
5 char *
6 strdup(const char *str)
8 if (str != NULL) {
9 register char *copy = malloc(strlen(str) + 1);
10 if (copy != NULL)
11 return strcpy(copy, str);
13 return NULL;