diff mbox

net/netlabel/netlabel_kapi.c: add missing cleanup code

Message ID 1313055633-25327-1-git-send-email-julia@diku.dk
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Julia Lawall Aug. 11, 2011, 9:40 a.m. UTC
From: Julia Lawall <julia@diku.dk>

Use the same cleanup code for the failure of kzalloc as for the failure of
kstrdup just below.

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 net/netlabel/netlabel_kapi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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

Comments

Dan Carpenter Aug. 11, 2011, 9:44 a.m. UTC | #1
On Thu, Aug 11, 2011 at 11:40:33AM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Use the same cleanup code for the failure of kzalloc as for the failure of
> kstrdup just below.
> 

That doesn't work.  The kfree(entry->domain) would cause an oops.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Julia Lawall Aug. 11, 2011, 9:52 a.m. UTC | #2
On Thu, 11 Aug 2011, Dan Carpenter wrote:

> On Thu, Aug 11, 2011 at 11:40:33AM +0200, Julia Lawall wrote:
> > From: Julia Lawall <julia@diku.dk>
> > 
> > Use the same cleanup code for the failure of kzalloc as for the failure of
> > kstrdup just below.
> > 
> 
> That doesn't work.  The kfree(entry->domain) would cause an oops.

Of course...  Thanks!

julia
--
To unsubscribe from this list: send the line "unsubscribe netdev" 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/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 58107d0..225e12c 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -341,7 +341,7 @@  int netlbl_cfg_cipsov4_map_add(u32 doi,
 
 	entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
 	if (entry == NULL)
-		return -ENOMEM;
+		goto cfg_cipsov4_map_add_failure;
 	if (domain != NULL) {
 		entry->domain = kstrdup(domain, GFP_ATOMIC);
 		if (entry->domain == NULL)