From: Alexander Beregalov <a.beregalov@gmail•com>
To: linux-next@vger•kernel.org, mchehab@redhat•com
Cc: Alexander Beregalov <a.beregalov@gmail•com>
Subject: [PATCH] i7core_edac: fix memory leak of i7core_dev
Date: Fri, 8 Jan 2010 05:27:30 +0300 [thread overview]
Message-ID: <1262917650-1901-1-git-send-email-a.beregalov@gmail.com> (raw)
Free already allocated i7core_dev.
Signed-off-by: Alexander Beregalov <a.beregalov@gmail•com>
---
drivers/edac/i7core_edac.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index e944b63..4de5a18 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1215,8 +1215,10 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
return -ENOMEM;
i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) * n_devs,
GFP_KERNEL);
- if (!i7core_dev->pdev)
+ if (!i7core_dev->pdev) {
+ kfree(i7core_dev);
return -ENOMEM;
+ }
i7core_dev->socket = socket;
i7core_dev->n_devs = n_devs;
list_add_tail(&i7core_dev->list, &i7core_edac_list);
--
1.6.6
reply other threads:[~2010-01-08 2:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1262917650-1901-1-git-send-email-a.beregalov@gmail.com \
--to=a.beregalov@gmail$(echo .)com \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=mchehab@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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