Skip to content

Fix crash with MAIL env variable - #18

Closed
bobbydurrett wants to merge 1 commit into
NetHack:NetHack-3.6.0from
bobbydurrett:mailenvfix
Closed

bobbydurrett wants to merge 1 commit into
NetHack:NetHack-3.6.0from
bobbydurrett:mailenvfix

Conversation

@bobbydurrett

@bobbydurrett bobbydurrett commented Jun 6, 2016 •

Copy link
Copy Markdown

This fix to mail.c prevents a core dump in free_maildata. I had the MAIL environment variable set to the path for my mailbox and whenever nethack exited it coredumped in free_maildata. Evidently the pointer being passed to free was not pointing to memory allocated in the heap. So, I modified the code to allocate a string off the heap for the mailbox path if this path came from an environment variable.

This issue was probably caused by the free mailbox at exit commit 3b38c75. This commit added code to free the mailbox memory but introduced a core dump because when an environment variable is set nh doesn't allocate memory off the heap.

@paxed

paxed commented Jun 18, 2016

Copy link
Copy Markdown
Contributor

Merged. Thanks!

@paxed paxed closed this Jun 18, 2016
@bobbydurrett
bobbydurrett deleted the mailenvfix branch October 27, 2016 17:34
@bobbydurrett
bobbydurrett restored the mailenvfix branch December 28, 2017 15:24
@bobbydurrett
bobbydurrett deleted the mailenvfix branch December 28, 2017 15:24
feiyunw pushed a commit to feiyunw/NetHack that referenced this pull request Jan 14, 2022
Fixed Issue NetHack#17 menu bar not saving changes
Fixed Issue NetHack#18 wrap status in portrait layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants