Fix resource leak
cover Fix resource leak
Fix two coverity issues.
Li Wang (2):
rbd: Release resource before return
mds: Release resource before return
src/mds/MDCache.cc | 2 +- src/rbd.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 2/2 mds: Release resource before return
Close file before return.
Fix coverity issue: CID 1019571
Signed-off-by Li Wang <[email protected]>
Reported-by Xianxia Xiao <[email protected]>
--- src/mds/MDCache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/mds/MDCache.cc +1 -1
@@ -11731,7 +11731,7 @@ void MDCache::dump_cache(const char *fn) std::string s = ss.str(); r = safe_write(fd, s.c_str(), s.length()); if (r < 0) - return; + goto out; list<CDir*> dfs; in->get_dirfrags(dfs);
Signature · 1 line
1.7.9.5
PATCH 1/2 rbd: Release resource before return
In reply to Li WangClose file before return.
Fix coverity issue: CID 1019579
Signed-off-by Li Wang <[email protected]>
Reported-by Xianxia Xiao <[email protected]>
--- src/rbd.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/rbd.cc +3 -3
@@ -1125,8 +1125,10 @@ static int do_export_diff(librbd::Image& image, const char *fromsnapname, ::encode(endsize, bl); r = bl.write_fd(fd); - if (r < 0) + if (r < 0) { + close(fd); return r; + } } ExportContext ec(&image, fd, info.size);
@@ -1139,8 +1141,6 @@ static int do_export_diff(librbd::Image& image, const char *fromsnapname, bufferlist bl; ::encode(tag, bl); r = bl.write_fd(fd); - if (r < 0) - return r; } out:
Signature · 1 line
1.7.9.5
Josh Durgin
AppliedQuoted 9 lines · Li Wang
Fix two coverity issues.
Li Wang (2):
rbd: Release resource before return
mds: Release resource before returnsrc/mds/MDCache.cc | 2 +- src/rbd.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Applied both, thanks!
Josh