[PATCH] pwdgrp::read_group(): Don't call free() twice with the same address

David Rothenberger daveroth@acm.org
Fri Aug 8 19:25:00 GMT 2003


This patch avoids the heap corruption that was causing the problem
described in

In pwdgrp::read_group(), there is loop to free allocated gr_mem
buffers.  That loop checks to see if gr_mem != &null_ptr, but does
not set gr_mem to &null_ptr after free() is called.  Subsequent
calls then attempt to free the same address again, corrupting the
malloc structures.

The tar test case triggers this behavior if there is no /etc
directory available, for some reason.


2003-08-08  David Rothenberger  <daveroth@acm.org>

	* grp.cc (read_group): Set __group32.gr_mem pointer back to
	&null_ptr after free() is called.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: grp.patch
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20030808/b0adb8c7/attachment.ksh>

More information about the Cygwin-patches mailing list