]> granicus.if.org Git - nethack/commitdiff
unix mail cleanup bulletproofing
authorPatR <rankin@nethack.org>
Thu, 26 May 2016 00:25:47 +0000 (17:25 -0700)
committerPatR <rankin@nethack.org>
Thu, 26 May 2016 00:25:47 +0000 (17:25 -0700)
If the recently added release routine ever gets called twice for
some reason, don't free already freed memory, or worse, was freed
here and then allocated for something else which is still in use.

src/mail.c

index 9c09fdc47af2bd5eaef303ce88390a7e5bcec4da..06ce1b266bdc219396014e5cde8d63810fb963f8 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 mail.c  $NHDT-Date: 1451955080 2016/01/05 00:51:20 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.25 $ */
+/* NetHack 3.6 mail.c  $NHDT-Date: 1464222344 2016/05/26 00:25:44 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.27 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -84,7 +84,7 @@ void
 free_maildata()
 {
     if (mailbox)
-        free(mailbox);
+        free((genericptr_t) mailbox), mailbox = (char *) 0;
 }
 
 void