Fix error handling in NIS.

A buffer was freed even though it wasn't allocated as expected.  Do
this only when !batch_read.
This commit is contained in:
Joe Landers 2009-10-29 19:59:59 -07:00 committed by Ulrich Drepper
parent 1a9e411e2a
commit c240c3a58f
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2009-10-29 Ulrich Drepper <drepper@redhat.com> 2009-10-29 Ulrich Drepper <drepper@redhat.com>
[BZ #10692]
* nis/nss_nis/nis-grp.c (internal_nis_getgrent_r): Don't free buffer
in error if batch_read. Patch by Joe Landers <jlanders@vmware.com>.
[BZ #10713] [BZ #10713]
* nis/nss_nis/nis-grp.c (internal_nis_endgrent): Start freeing blocks * nis/nss_nis/nis-grp.c (internal_nis_endgrent): Start freeing blocks
from intern.start. Patch by Joe Landers <jlanders@vmware.com>. from intern.start. Patch by Joe Landers <jlanders@vmware.com>.

View File

@ -204,7 +204,8 @@ internal_nis_getgrent_r (struct group *grp, char *buffer, size_t buflen,
if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) if (__builtin_expect ((size_t) (len + 1) > buflen, 0))
{ {
free (result); if (!batch_read)
free (result);
*errnop = ERANGE; *errnop = ERANGE;
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
} }