Coverity CID 5028: Fix memory leak.

This commit is contained in:
christos 2008-05-24 16:04:15 +00:00
parent c188bc4dd4
commit be2cd377db
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: getnetpath.c,v 1.13 2008/04/25 17:44:44 christos Exp $ */
/* $NetBSD: getnetpath.c,v 1.14 2008/05/24 16:04:15 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)getnetpath.c 1.11 91/12/19 SMI";
#else
__RCSID("$NetBSD: getnetpath.c,v 1.13 2008/04/25 17:44:44 christos Exp $");
__RCSID("$NetBSD: getnetpath.c,v 1.14 2008/05/24 16:04:15 christos Exp $");
#endif
#endif
@ -184,8 +184,10 @@ getnetpath(handlep)
if ((ncp = getnetconfigent(npp)) != NULL) {
/* cobble alloc chain entry */
chainp = malloc(sizeof (struct netpath_chain));
if (chainp == NULL)
if (chainp == NULL) {
freenetconfigent(ncp);
return NULL;
}
chainp->ncp = ncp;
chainp->nchain_next = NULL;
if (np_sessionp->ncp_list == NULL)