From 32abdb710c9335481da780eab5ad790318d2fadf Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 16 May 1999 10:14:25 +0000 Subject: Update. 1999-05-16 Thorsten Kukuk * sunrpc/etc.rpc: Add portmapper, rstat_svc and pcnfs. * sunrpc/key_call.c: Fix memory leak, close file handle. * nis/nis_creategroup.c: Use malloc instead of calloc, set ctime and mtime. * nis/nis_subr.c: Check for realloc result. * nis/nis_file.c: Fix memory leak. * nis/nis_table.c: Pretty print. * nis/nis_getservlist.c: Likewise. * nis/nis_ismember.c: Likewise. * nis/nis_lookup.c: Likewise. * nis/nis_ping.c: Likewise. * nis/nis_removemember.c: Likewise. * nis/nis_util.c: Likewise, check calloc result. --- nis/nis_file.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'nis/nis_file.c') diff --git a/nis/nis_file.c b/nis/nis_file.c index 8d652c30e5..13dbed8ef6 100644 --- a/nis/nis_file.c +++ b/nis/nis_file.c @@ -1,6 +1,6 @@ /* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Thorsten Kukuk , 1997. + Contributed by Thorsten Kukuk , 1997. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -82,15 +82,19 @@ nis_read_obj (const char *name) XDR xdrs; FILE *in; bool_t status; - nis_object *obj = calloc (1, sizeof (nis_object)); - - if (obj == NULL) - return NULL; + nis_object *obj; in = fopen (name, "rb"); if (in == NULL) return NULL; + obj = calloc (1, sizeof (nis_object)); + if (obj == NULL) + { + fclose (in); + return NULL; + } + xdrstdio_create (&xdrs, in, XDR_DECODE); status =_xdr_nis_object (&xdrs, obj); xdr_destroy (&xdrs); -- cgit 1.4.1