Project

General

Profile

Bug #14332

RBD: potential memory leak if image ctx is unable to open.

Added by xie xingguo over 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
High
Assignee:
-
Target version:
-
Start date:
01/11/2016
Due date:
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

Description

For example:

int remove(IoCtx& io_ctx, const char *imgname, ProgressContext& prog_ctx)
{
    CephContext *cct((CephContext *)io_ctx.cct());
    ldout(cct, 20) << "remove " << &io_ctx << " " << imgname << dendl;

    string id;
    bool old_format = false;
    bool unknown_format = true;
    ImageCtx *ictx = new ImageCtx(imgname, "", NULL, io_ctx, false);
    int r = ictx->state->open();
    if (r < 0)
    {
        ldout(cct, 2) << "error opening image: " << cpp_strerror(-r) << dendl;
        delete ictx; // shall manually delete ictx here.

Associated revisions

Revision 3df756c3 (diff)
Added by xie xingguo over 3 years ago

RBD: fix potential memory leak

Fixes: #14332
Signed-off-by: xie xingguo <>

History

#1 Updated by Sage Weil over 3 years ago

  • Project changed from Ceph to rbd

#2 Updated by Jason Dillaman over 3 years ago

  • Status changed from New to Resolved

#3 Updated by Nathan Cutler over 2 years ago

  • Description updated (diff)

Also available in: Atom PDF