From b2b6d75a05293578d1a2d8ac3a837b54ea08a3bb Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Mon, 24 Nov 2003 12:21:33 +0000 Subject: [PATCH] . In NDEBUG, safefree() is just free(). . Originally there were three places where a pointer was NULL'd after being freed. One of these is actually important, so annotate it. --- trunk/darkhttpd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/trunk/darkhttpd.c b/trunk/darkhttpd.c index d7314b4..c780d26 100644 --- a/trunk/darkhttpd.c +++ b/trunk/darkhttpd.c @@ -52,7 +52,11 @@ /* for easy defusal */ #define debugf printf +#ifdef NDEBUG +#define safefree free +#else #define safefree(x) do { free(x); x = NULL; } while(0) +#endif #ifndef min #define min(a,b) ( ((a)<(b)) ? (a) : (b) ) @@ -1651,7 +1655,8 @@ static void process_request(struct connection *conn) conn->state = SEND_HEADER; /* request not needed anymore */ - safefree(conn->request); + free(conn->request); + conn->request = NULL; /* important: don't free it again later */ }