diff options
author | Noah Watkins <noahwatkins@gmail.com> | 2011-09-12 17:51:58 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2011-10-25 19:10:16 -0400 |
commit | 49d9224c047f23089c49a6749609447abd09ee03 (patch) | |
tree | 4e0b057f29b006f8143a5350baf6e056f9c75faf /net/ceph/mon_client.c | |
parent | a35eca958aa1c7d0b5f993db1a3ded45ae16d59b (diff) |
ceph: fix ceph_monc_init memory leak
failure clean up does not consider ceph_auth_init.
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph/mon_client.c')
-rw-r--r-- | net/ceph/mon_client.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index af2ef3082499..0b62deae42bd 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -759,8 +759,10 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) | |||
759 | /* authentication */ | 759 | /* authentication */ |
760 | monc->auth = ceph_auth_init(cl->options->name, | 760 | monc->auth = ceph_auth_init(cl->options->name, |
761 | cl->options->key); | 761 | cl->options->key); |
762 | if (IS_ERR(monc->auth)) | 762 | if (IS_ERR(monc->auth)) { |
763 | return PTR_ERR(monc->auth); | 763 | err = PTR_ERR(monc->auth); |
764 | goto out_con; | ||
765 | } | ||
764 | monc->auth->want_keys = | 766 | monc->auth->want_keys = |
765 | CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON | | 767 | CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON | |
766 | CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS; | 768 | CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS; |
@@ -771,7 +773,7 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) | |||
771 | sizeof(struct ceph_mon_subscribe_ack), | 773 | sizeof(struct ceph_mon_subscribe_ack), |
772 | GFP_NOFS, true); | 774 | GFP_NOFS, true); |
773 | if (!monc->m_subscribe_ack) | 775 | if (!monc->m_subscribe_ack) |
774 | goto out_con; | 776 | goto out_auth; |
775 | 777 | ||
776 | monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS, | 778 | monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS, |
777 | true); | 779 | true); |
@@ -809,6 +811,8 @@ out_subscribe: | |||
809 | ceph_msg_put(monc->m_subscribe); | 811 | ceph_msg_put(monc->m_subscribe); |
810 | out_subscribe_ack: | 812 | out_subscribe_ack: |
811 | ceph_msg_put(monc->m_subscribe_ack); | 813 | ceph_msg_put(monc->m_subscribe_ack); |
814 | out_auth: | ||
815 | ceph_auth_destroy(monc->auth); | ||
812 | out_con: | 816 | out_con: |
813 | monc->con->ops->put(monc->con); | 817 | monc->con->ops->put(monc->con); |
814 | out_monmap: | 818 | out_monmap: |