summaryrefslogtreecommitdiff
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d5f5981d7a43..8851c9463b4b 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1122,9 +1122,10 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (err > 0)
err = ip_cmsg_send(sk, msg, &ipc,
sk->sk_family == AF_INET6);
- if (unlikely(err < 0))
+ if (unlikely(err < 0)) {
+ kfree(ipc.opt);
return err;
-
+ }
if (ipc.opt)
free = 1;
connected = 0;