diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 8b164faa2a07..3f089c0eb184 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -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); diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 76a66a4df25f..a9eaa0d82328 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -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); }