Fix a memory leak in check_bound() by freeing the buffer area of

the netbuf before freeing the netbuf structure itself.
This commit is contained in:
Ian Dowse 2001-07-14 17:17:48 +00:00
parent 05c4b26e95
commit c8a28c2ec9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=79722

View File

@ -94,6 +94,7 @@ check_bound(struct fdlist *fdl, char *uaddr)
fd = __rpc_nconf2fd(fdl->nconf);
if (fd < 0) {
free(na->buf);
free(na);
return (TRUE);
}
@ -101,6 +102,7 @@ check_bound(struct fdlist *fdl, char *uaddr)
ans = bind(fd, (struct sockaddr *)na->buf, na->len);
close(fd);
free(na->buf);
free(na);
return (ans == 0 ? FALSE : TRUE);