ceph: Free mdsc if alloc mdsc->mdsmap failed.
authormajianpeng <majianpeng@gmail.com>
Tue, 25 Jun 2013 06:48:19 +0000 (14:48 +0800)
committerSage Weil <sage@inktank.com>
Wed, 3 Jul 2013 22:32:53 +0000 (15:32 -0700)
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Reviewed-by: Sage Weil <sage@inktank.com>
fs/ceph/mds_client.c

index 6272c7884e6613390e3b8ec5727ba7b6ba77d2c7..3eb1b4470c855dad36655c5f6cf903dbe2ecf0f7 100644 (file)
@@ -3042,8 +3042,10 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
        fsc->mdsc = mdsc;
        mutex_init(&mdsc->mutex);
        mdsc->mdsmap = kzalloc(sizeof(*mdsc->mdsmap), GFP_NOFS);
-       if (mdsc->mdsmap == NULL)
+       if (mdsc->mdsmap == NULL) {
+               kfree(mdsc);
                return -ENOMEM;
+       }
 
        init_completion(&mdsc->safe_umount_waiters);
        init_waitqueue_head(&mdsc->session_close_wq);