Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d17a18dd92c91c784fcf7c785fa6bbf178fd0a6d
Commit:     d17a18dd92c91c784fcf7c785fa6bbf178fd0a6d
Parent:     bbd0682596f7a434467ee551fee18d5f0b818539
Author:     Dave Young <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 17 16:20:00 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Dec 17 19:28:16 2007 -0800

    pktcdvd: add kobject_put when kobject register fails
    
    In kobject_register, the kobject reference is get in kobject_init, and then
    kobject_add.  If kobject_add fail, it will only cleanup the reference got
    by itself.
    
    Signed-off-by: Dave Young <[EMAIL PROTECTED]>
    Reviewed-by: Pekka Enberg <[EMAIL PROTECTED]>
    Cc: Greg KH <[EMAIL PROTECTED]>
    Cc: Peter Osterlund <[EMAIL PROTECTED]>
    Cc: Jens Axboe <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/block/pktcdvd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a5ee213..3535ef8 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -117,8 +117,10 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct 
pktcdvd_device *pd,
        p->kobj.parent = parent;
        p->kobj.ktype = ktype;
        p->pd = pd;
-       if (kobject_register(&p->kobj) != 0)
+       if (kobject_register(&p->kobj) != 0) {
+               kobject_put(&p->kobj);
                return NULL;
+       }
        return p;
 }
 /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to