Sun bug #6739431: double free in _X11TransConnectDisplay()

Double free() introduced in bf53987eaf
After copying original_hostname to phostname, set original_hostname
to NULL, so we don't free the same pointer twice when we free both
original_hostname and phostname.

<http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6739431>
This commit is contained in:
Alan Coopersmith 2008-10-07 15:41:38 -07:00
parent 0877bc916a
commit e7ece39afc

View file

@ -407,6 +407,7 @@ _X11TransConnectDisplay (
if (reset_hostname && (phostname != original_hostname)) {
Xfree (phostname);
phostname = original_hostname;
original_hostname = NULL;
}
#endif
len = ((phostname ? strlen(phostname) : 0) + 1 + (dnet ? 1 : 0) +