Add missing check for nl_socket_alloc failure
PATCH v2 1/1 Add missing check for nl_socket_alloc failure
This can happen if the memory alloc fails.
Patch V2: add goto error
Change-Id Iee66caa794d267ac5f8bee584633352893047171
Signed-off-by Arne Schwabe <[email protected]...>
--- src/openvpn/dco_linux.c | 7 +++++++ 1 file changed, 7 insertions(+)
src/openvpn/dco_linux.c +7 -0
@@ -83,6 +83,13 @@ resolve_ovpn_netlink_id(int msglevel)int ret;struct nl_sock *nl_sock =nl_socket_alloc (); +if (!nl_sock) + { +msg (msglevel,"Allocating net link socket failed" ); + ret =-1 ; + goto err_sock; + } + ret =genl_connect (nl_sock);if (ret) {
Signature · 1 line
2.37.1 (Apple Git-137.1)
Hi,
Quoted 6 lines · Arne Schwabe
This can happen if the memory alloc fails.
Patch V2: add goto error
Change-Id Iee66caa794d267ac5f8bee584633352893047171Signed-off-by Arne Schwabe <[email protected]...>
This patch seems to be a duplicate?
I also commented the "old v2".
Cheers,
Quoted 22 lines
--- src/openvpn/dco_linux.c | 7 +++++++ 1 file changed, 7 insertions(+)src/openvpn/dco_linux.c +7
-0@@ -83,6 +83,13 @@ resolve_ovpn_netlink_id(int msglevel)int ret;struct nl_sock *nl_sock =nl_socket_alloc (); +if (!nl_sock) + { +msg (msglevel,"Allocating net link socket failed" ); + ret =-1 ; + goto err_sock; + } + ret =genl_connect (nl_sock);if (ret) {
Signature · 4 lines
Antonio Quartulli -- Antonio Quartulli