summaryrefslogtreecommitdiff
path: root/net/ipv4/ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ping.c')
-rw-r--r--net/ipv4/ping.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index c588f9f2f46c..1e44a43acfe2 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -727,9 +727,10 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (msg->msg_controllen) {
err = ip_cmsg_send(sk, msg, &ipc, false);
- if (unlikely(err))
+ if (unlikely(err)) {
+ kfree(ipc.opt);
return err;
-
+ }
if (ipc.opt)
free = 1;
}