prevent a potential resource leak, not found by coverity (perhaps masked by previous)

This commit is contained in:
dan 2006-03-18 21:41:23 +00:00
parent 3713fec029
commit 6ff40a4cfb

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.14 2006/03/18 21:35:35 dan Exp $ */
/* $NetBSD: if.c,v 1.15 2006/03/18 21:41:23 dan Exp $ */
/* $KAME: if.c,v 1.18 2002/05/31 10:10:03 itojun Exp $ */
/*
@ -275,8 +275,10 @@ if_nametosdl(char *name)
return(NULL);
}
if ((ret_sdl = malloc(sdl->sdl_len)) == NULL)
if ((ret_sdl = malloc(sdl->sdl_len)) == NULL) {
free(buf);
return(NULL);
}
memcpy((caddr_t)ret_sdl, (caddr_t)sdl, sdl->sdl_len);
free(buf);