Messages in this thread Patch in this message | | | Date | Tue, 23 Sep 2003 13:14:53 -0700 | From | Chris Wright <> | Subject | Re: [CHECKER] 32 Memory Leaks on Error Paths |
| |
* David Yu Chen (dychen@stanford.edu) wrote: > [FILE: 2.6.0-test5/net/sunrpc/auth_gss/gss_mech_switch.c] > START --> > 67: if (!(gm = kmalloc(sizeof(*gm), GFP_KERNEL))) { > 68: printk("Failed to allocate memory in gss_mech_register"); > 69: return -1; > 70: } > 71: gm->gm_oid.len = mech_type->len; > 72: if (!(gm->gm_oid.data = kmalloc(mech_type->len, GFP_KERNEL))) { > 73: printk("Failed to allocate memory in gss_mech_register"); > END --> > 74: return -1; <snip> > [FILE: 2.6.0-test5/net/sunrpc/auth_gss/gss_pseudoflavors.c] > [FUNC: gss_register_triple] > START --> > 74: if (!(triple = kmalloc(sizeof(*triple), GFP_KERNEL))) { > 75: printk("Alloc failed in gss_register_triple"); > GOTO --> > 86: goto err_unlock; > END --> > 97: return -1;
Yes, these are both bugs. Patch below. Trond, this look ok?
thanks, -chris
===== net/sunrpc/auth_gss/gss_mech_switch.c 1.2 vs edited ===== --- 1.2/net/sunrpc/auth_gss/gss_mech_switch.c Wed Jun 11 19:25:40 2003 +++ edited/net/sunrpc/auth_gss/gss_mech_switch.c Tue Sep 23 12:18:26 2003 @@ -71,6 +71,7 @@ gm->gm_oid.len = mech_type->len; if (!(gm->gm_oid.data = kmalloc(mech_type->len, GFP_KERNEL))) { printk("Failed to allocate memory in gss_mech_register"); + kfree(gm); return -1; } memcpy(gm->gm_oid.data, mech_type->data, mech_type->len); ===== net/sunrpc/auth_gss/gss_pseudoflavors.c 1.1 vs edited ===== --- 1.1/net/sunrpc/auth_gss/gss_pseudoflavors.c Sun Jan 12 13:40:13 2003 +++ edited/net/sunrpc/auth_gss/gss_pseudoflavors.c Tue Sep 23 12:24:47 2003 @@ -93,6 +93,7 @@ err_unlock: spin_unlock(®istered_triples_lock); + kfree(triple); err: return -1; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |