fixed a potential memory leak

Obtained from: KAME
MFC after: 1 day
This commit is contained in:
SUZUKI Shinsuke 2006-03-24 23:59:51 +00:00
parent 256c62e23f
commit 4b8b545e4b

View File

@ -277,8 +277,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);