Skip to content

Commit

Permalink
rbd: fix memory leak when fails to get the address
Browse files Browse the repository at this point in the history
Signed-off-by: Xiubo Li <[email protected]>
  • Loading branch information
lxbsz committed Aug 30, 2021
1 parent 9fa64b3 commit bdc361a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,10 +1210,12 @@ static int tcmu_rbd_open(struct tcmu_device *dev, bool reopen)
#ifdef LIBRADOS_SUPPORTS_GETADDRS
/* Get current entry address for the image */
ret = rados_getaddrs(state->cluster, &state->addrs);
tcmu_dev_info(dev, "address: {%s}\n", state->addrs);
if (ret < 0) {
tcmu_dev_err(dev, "failed getting the address\n");
goto stop_image;
}
tcmu_dev_info(dev, "opened, the address: {%s}\n", state->addrs);
pthread_mutex_unlock(&rdev->priv_lock);
if (ret < 0)
return ret;
#endif

free(dev_cfg_dup);
Expand Down

0 comments on commit bdc361a

Please sign in to comment.