diff mbox

libceph: fix a memory leak in handle_watch_notify

Message ID 1410394821-13054-1-git-send-email-roy.qing.li@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

roy.qing.li@gmail.com Sept. 11, 2014, 12:20 a.m. UTC
From: Li RongQing <roy.qing.li@gmail.com> 

event_work should be freed when adding it to queue failed

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/ceph/osd_client.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Alex Elder Sept. 11, 2014, 1:41 a.m. UTC | #1
On 09/10/2014 07:20 PM, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
>
> event_work should be freed when adding it to queue failed
>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>

Looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
>   net/ceph/osd_client.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 30f6faf..1e1b4f1 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -2323,6 +2323,7 @@ static void handle_watch_notify(struct ceph_osd_client *osdc,
>   		event_work->opcode = opcode;
>   		if (!queue_work(osdc->notify_wq, &event_work->work)) {
>   			dout("WARNING: failed to queue notify event work\n");
> +			kfree(event_work);
>   			goto done_err;
>   		}
>   	}
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 30f6faf..1e1b4f1 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -2323,6 +2323,7 @@  static void handle_watch_notify(struct ceph_osd_client *osdc,
 		event_work->opcode = opcode;
 		if (!queue_work(osdc->notify_wq, &event_work->work)) {
 			dout("WARNING: failed to queue notify event work\n");
+			kfree(event_work);
 			goto done_err;
 		}
 	}