aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-03-08 15:31:44 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-03-08 15:31:44 +0000
commitfe3c8740010a9ca421606db87adcabe9a5432d55 (patch)
treee9a484eb9f3e75a3ea067563daff03282b78b85a
parentd9459b54d9c79267fd02e989ae3e86bdc4e8a983 (diff)
detect fclose(NULL)
-rw-r--r--lib/memdebug.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 2ae203d60..5f274b728 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -200,7 +200,15 @@ FILE *curl_fopen(const char *file, const char *mode,
int curl_fclose(FILE *file, int line, const char *source)
{
- int res=(fclose)(file);
+ int res;
+
+ if(NULL == file) {
+ fprintf(stderr, "ILLEGAL flose() on NULL at %s:%d\n",
+ source, line);
+ exit(2);
+ }
+
+ res=(fclose)(file);
if(logfile)
fprintf(logfile, "FILE %s:%d fclose(%p)\n",
source, line, file);