mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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:
parent
15cc91d345
commit
b33887ea31
2 changed files with 10 additions and 5 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@ done1:
|
|||
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 @@ done1:
|
|||
fdrop(fp, td);
|
||||
done2:
|
||||
NET_UNLOCK_GIANT();
|
||||
FREE(sa, M_SONAME);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue