netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] isdn/gigaset: add a kfree() to error path
@ 2010-06-28 21:20 Dan Carpenter
  2010-06-29 22:18 ` Tilman Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2010-06-28 21:20 UTC (permalink / raw)
  To: Hansjoerg Lipp
  Cc: Tilman Schmidt, Karsten Keil, David S. Miller, gigaset307x-common,
	netdev, kernel-janitors

We should free "commands" here.  The main reason is to please the static
checkers.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index f01c3c2..f1abb8f 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -419,6 +419,7 @@ oom:
 	dev_err(bcs->cs->dev, "out of memory\n");
 	for (i = 0; i < AT_NUM; ++i)
 		kfree(commands[i]);
+	kfree(commands);
 	return -ENOMEM;
 }
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] isdn/gigaset: add a kfree() to error path
  2010-06-28 21:20 [patch] isdn/gigaset: add a kfree() to error path Dan Carpenter
@ 2010-06-29 22:18 ` Tilman Schmidt
  2010-06-29 22:33   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Tilman Schmidt @ 2010-06-29 22:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Hansjoerg Lipp, Karsten Keil, David S. Miller, gigaset307x-common,
	netdev, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1411 bytes --]

Dan,

thanks for your patch. It is quite correct as it stands.
There is however another problem with that error path, in
that it also doesn't free the previously allocated channel.
I prefer not to carry two separate patches for that, so I'm
replacing your patch with the following augmented patch,
which I'll submit together with my other pending patches
for 2.6.36 soon:

Subject: [PATCH] isdn/gigaset: fix leaks in error path

Take care to free all previously allocated ressources in the
"out of memory" error path of the ISDN_CMD_DIAL branch.
Based on an original patch by Dan Carpenter.

Impact: bugfix
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/gigaset/i4l.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 1d084bb..34bca37 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -419,6 +419,8 @@ oom:
 	dev_err(bcs->cs->dev, "out of memory\n");
 	for (i = 0; i < AT_NUM; ++i)
 		kfree(commands[i]);
+	kfree(commands);
+	gigaset_free_channel(bcs);
 	return -ENOMEM;
 }
 
-- 
1.6.5.3.298.g39add

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] isdn/gigaset: add a kfree() to error path
  2010-06-29 22:18 ` Tilman Schmidt
@ 2010-06-29 22:33   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-06-29 22:33 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: Hansjoerg Lipp, Karsten Keil, David S. Miller, gigaset307x-common,
	netdev, kernel-janitors

On Wed, Jun 30, 2010 at 12:18:15AM +0200, Tilman Schmidt wrote:
> Dan,
> 
> thanks for your patch. It is quite correct as it stands.
> There is however another problem with that error path, in
> that it also doesn't free the previously allocated channel.
> I prefer not to carry two separate patches for that, so I'm
> replacing your patch with the following augmented patch,
> which I'll submit together with my other pending patches
> for 2.6.36 soon:
> 

Good deal.

Acked-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-29 22:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28 21:20 [patch] isdn/gigaset: add a kfree() to error path Dan Carpenter
2010-06-29 22:18 ` Tilman Schmidt
2010-06-29 22:33   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).