Bug 674

Summary: Do not free ponters given by getenv()
Product: unbound Reporter: Thomas Winget <tewinget>
Component: serverAssignee: unbound team <unbound-team>
Status: RESOLVED FIXED    
Severity: major CC: cathya, tewinget, wouter
Priority: P5    
Version: unspecified   
Hardware: All   
OS: Windows   
Attachments: patch, modify paths as needed

Description Thomas Winget 2015-06-02 00:56:10 CEST
Created attachment 284 [details]
patch, modify paths as needed

In the file unbound/libunbound/libunbound.c, if Windows is detected as the OS and no hosts file is specified, libunbound uses getenv() to determine the system-wide hosts file.  It should not be calling free() on the pointer returned by getenv(), see here: https://stackoverflow.com/questions/4237812/should-i-free-delete-char-returned-by-getenv

Simply removing the call to free() should be sufficient to address the issue.
Comment 1 Wouter Wijngaards 2015-06-02 09:34:28 CEST
Hi Thomas,

Thank you for the fixup.  Committed.

Best regards,
   Wouter