tsort: suppress a valgrind memory leak warning
authorPádraig Brady <P@draigBrady.com>
Thu, 25 Nov 2010 19:16:00 +0000 (19:16 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 27 Nov 2010 03:27:49 +0000 (03:27 +0000)
* src/tsort.c (tsort): Unconditionally invoking the free()
doesn't increase scalability, so do it only with -Dlint

src/tsort.c

index 4f51f30..0179a4e 100644 (file)
@@ -487,6 +487,11 @@ tsort (const char *file)
 
           /* T5. Output front of queue.  */
           puts (head->str);
+#ifdef lint
+          /* suppress valgrind "definitely lost" warnings.  */
+          void *head_str = (void *) head->str;
+          free (head_str);
+#endif
           head->str = NULL;    /* Avoid printing the same string twice.  */
           n_strings--;