-/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
res2 = nis_lookup (dirname, EXPAND_NAME);
if (NIS_RES_STATUS (res2) != NIS_SUCCESS)
- return res2;
+ {
+ free (res);
+ return res2;
+ }
/* Check if obj is really a diryectory object */
if (__type_of (NIS_RES_OBJECT (res2)) != NIS_DIRECTORY_OBJ)
{
+ nis_freeresult (res2);
nis_freeresult (res);
NIS_RES_STATUS (res) = NIS_INVALIDOBJ;
return res;