From: Travis Cross Date: Sun, 3 Feb 2013 19:55:50 +0000 (+0000) Subject: Resolve -Wnull-dereference clang warning X-Git-Tag: v0.83~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f32b53b1dbb79a41c3ebdf6102231282a76d212f;p=thirdparty%2Fmtr.git Resolve -Wnull-dereference clang warning Clang will simply delete the indirection of the non-volatile null pointer. --- diff --git a/dns.c b/dns.c index 512da97..6a76bc1 100644 --- a/dns.c +++ b/dns.c @@ -371,12 +371,12 @@ void statfree(void *p) if (p) { if (*((dword *)p - HEAD_SLACK) == 0) { fprintf(stderr,"ERROR: Attempt to free pointer twice.\n"); - *(int*)0=0; + abort(); exit(-1); } else { if (*((dword *)p - HEAD_SLACK) > 8192) { fprintf (stderr,"ERROR: Corrupted free() buffer. (header)\n"); - *(int*)0=0; + abort(); exit(-1); } #ifdef CorruptCheck @@ -385,7 +385,7 @@ void statfree(void *p) (*(byte *)((char *)p + (*((dword *)p - 1)) + sizeof(byte) * 2) != 0xbe) || (*(byte *)((char *)p + (*((dword *)p - 1)) + sizeof(byte) * 3) != 0xef)) { fprintf(stderr,"ERROR: Corrupted free() buffer. (footer)\n"); - *(int*)0=0; + abort(); exit(-1); } #endif