Staging
v0.5.1
https://github.com/python/cpython
Revision 10b1cd9d809f0d47d5b4664d7ff55cb503fb085d authored by Guido van Rossum on 29 May 2003, 14:31:42 UTC, committed by Guido van Rossum on 29 May 2003, 14:31:42 UTC
Also move the call of the test to the top; the crash is caused by a
double free.
1 parent f9622d1
Raw File
Tip revision: 10b1cd9d809f0d47d5b4664d7ff55cb503fb085d authored by Guido van Rossum on 29 May 2003, 14:31:42 UTC
Remove debug code from weakref_segfault().
Tip revision: 10b1cd9
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

char *
strdup(const char *str)
{
	if (str != NULL) {
		register char *copy = malloc(strlen(str) + 1);
		if (copy != NULL)
			return strcpy(copy, str);
	}
	return NULL;
}
back to top