Don't free the sockaddr in kern_bind() and kern_connect() as not all

callers pass a sockaddr allocated via malloc() from M_SONAME anymore.
Instead, free it in the callers when necessary.
This commit is contained in:
John Baldwin 2006-07-19 18:28:52 +00:00
parent 15cc91d345
commit b33887ea31
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160506
2 changed files with 10 additions and 5 deletions

View File

@ -609,7 +609,9 @@ linux_bind(struct thread *td, struct linux_bind_args *args)
if (error)
return (error);
return (kern_bind(td, linux_args.s, sa));
error = kern_bind(td, linux_args.s, sa);
free(sa, M_SONAME);
return (error);
}
struct linux_connect_args {
@ -638,6 +640,7 @@ linux_connect(struct thread *td, struct linux_connect_args *args)
return (error);
error = kern_connect(td, linux_args.s, sa);
free(sa, M_SONAME);
if (error != EISCONN)
return (error);

View File

@ -209,7 +209,9 @@ bind(td, uap)
if ((error = getsockaddr(&sa, uap->name, uap->namelen)) != 0)
return (error);
return (kern_bind(td, uap->s, sa));
error = kern_bind(td, uap->s, sa);
free(sa, M_SONAME);
return (error);
}
int
@ -241,7 +243,6 @@ kern_bind(td, fd, sa)
fdrop(fp, td);
done2:
NET_UNLOCK_GIANT();
FREE(sa, M_SONAME);
return (error);
}
@ -534,7 +535,9 @@ connect(td, uap)
if (error)
return (error);
return (kern_connect(td, uap->s, sa));
error = kern_connect(td, uap->s, sa);
free(sa, M_SONAME);
return (error);
}
@ -596,7 +599,6 @@ kern_connect(td, fd, sa)
fdrop(fp, td);
done2:
NET_UNLOCK_GIANT();
FREE(sa, M_SONAME);
return (error);
}