From: Cong Ding <dinggnu@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Clark <rob@ti.com>, Seung-Woo Kim <sw0312.kim@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>,
YAMANE Toshiaki <yamanetoshi@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: Cong Ding <dinggnu@gmail.com>
Subject: [PATCH] staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage
Date: Tue, 15 Jan 2013 20:46:50 +0100 [thread overview]
Message-ID: <1358279214-4820-1-git-send-email-dinggnu@gmail.com> (raw)
There is a memory leakage in variable sg if it goes to error.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
drivers/staging/omapdrm/omap_gem_dmabuf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/omapdrm/omap_gem_dmabuf.c b/drivers/staging/omapdrm/omap_gem_dmabuf.c
index b6c5b5c..a3236ab 100644
--- a/drivers/staging/omapdrm/omap_gem_dmabuf.c
+++ b/drivers/staging/omapdrm/omap_gem_dmabuf.c
@@ -53,10 +53,10 @@ static struct sg_table *omap_gem_map_dma_buf(
/* this should be after _get_paddr() to ensure we have pages attached */
omap_gem_dma_sync(obj, dir);
-out:
- if (ret)
- return ERR_PTR(ret);
return sg;
+out:
+ kfree(sg);
+ return ERR_PTR(ret);
}
static void omap_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
--
1.7.10.4
next reply other threads:[~2013-01-15 19:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 19:46 Cong Ding [this message]
2013-01-15 21:14 ` [PATCH] staging: omapdrm/omap_gem_dmabuf.c: fix memory leakage Rob Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358279214-4820-1-git-send-email-dinggnu@gmail.com \
--to=dinggnu@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob@ti.com \
--cc=sw0312.kim@samsung.com \
--cc=yamanetoshi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox