]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
Resolve -Wnull-dereference clang warning
authorTravis Cross <tc@traviscross.com>
Sun, 3 Feb 2013 19:55:50 +0000 (19:55 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 3 Feb 2013 20:58:50 +0000 (20:58 +0000)
Clang will simply delete the indirection of the non-volatile null
pointer.

dns.c

diff --git a/dns.c b/dns.c
index 512da972dda2ef97f5947da28281a387ba1c9519..6a76bc199dbfdde059fa35005f7a1130677c0c54 100644 (file)
--- 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