(nis_list): If __follow_path fails in the new code, make sure the
authordrepper <drepper>
Fri, 6 Oct 2006 20:31:59 +0000 (20:31 +0000)
committerdrepper <drepper>
Fri, 6 Oct 2006 20:31:59 +0000 (20:31 +0000)
nis_freeresult call doesn't crash and that the result is reported
correctly.

nis/nis_table.c

index f898e3c..cb25be6 100644 (file)
@@ -438,7 +438,11 @@ nis_list (const_nis_name name, unsigned int flags,
                                             &bptr);
                if (clnt_status != NIS_SUCCESS)
                  {
-                   NIS_RES_STATUS (res) = clnt_status;
+                   /* Prepare for the nis_freeresult call.  */
+                   memset (res, '\0', sizeof (*res));
+
+                   if (clnt_status == NIS_NOMEMORY)
+                     NIS_RES_STATUS (allres) = clnt_status;
                    ++done;
                  }
              }