All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix resource leak
@ 2013-11-18  7:40 Li Wang
  2013-11-18  7:40 ` [PATCH 1/2] rbd: Release resource before return Li Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Li Wang @ 2013-11-18  7:40 UTC (permalink / raw)
  To: ceph-devel; +Cc: Sage Weil, Li Wang

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(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] rbd: Release resource before return
  2013-11-18  7:40 [PATCH 0/2] Fix resource leak Li Wang
@ 2013-11-18  7:40 ` Li Wang
  2013-11-18  7:40 ` [PATCH 2/2] mds: " Li Wang
  2013-11-25 22:02 ` [PATCH 0/2] Fix resource leak Josh Durgin
  2 siblings, 0 replies; 4+ messages in thread
From: Li Wang @ 2013-11-18  7:40 UTC (permalink / raw)
  To: ceph-devel; +Cc: Sage Weil, Li Wang

Close file before return.
Fix coverity issue: CID 1019579

Signed-off-by: Li Wang <liwang@ubuntukylin.com>
Reported-by: Xianxia Xiao <xianxiaxiao@ubuntukylin.com>
---
 src/rbd.cc |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rbd.cc b/src/rbd.cc
index 41cd243..9556fb8 100644
--- a/src/rbd.cc
+++ b/src/rbd.cc
@@ -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:
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] mds: Release resource before return
  2013-11-18  7:40 [PATCH 0/2] Fix resource leak Li Wang
  2013-11-18  7:40 ` [PATCH 1/2] rbd: Release resource before return Li Wang
@ 2013-11-18  7:40 ` Li Wang
  2013-11-25 22:02 ` [PATCH 0/2] Fix resource leak Josh Durgin
  2 siblings, 0 replies; 4+ messages in thread
From: Li Wang @ 2013-11-18  7:40 UTC (permalink / raw)
  To: ceph-devel; +Cc: Sage Weil, Li Wang

Close file before return.
Fix coverity issue: CID 1019571

Signed-off-by: Li Wang <liwang@ubuntukylin.com>
Reported-by: Xianxia Xiao <xianxiaxiao@ubuntukylin.com>
---
 src/mds/MDCache.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index ae59c26..17d4ce4 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -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);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Fix resource leak
  2013-11-18  7:40 [PATCH 0/2] Fix resource leak Li Wang
  2013-11-18  7:40 ` [PATCH 1/2] rbd: Release resource before return Li Wang
  2013-11-18  7:40 ` [PATCH 2/2] mds: " Li Wang
@ 2013-11-25 22:02 ` Josh Durgin
  2 siblings, 0 replies; 4+ messages in thread
From: Josh Durgin @ 2013-11-25 22:02 UTC (permalink / raw)
  To: Li Wang, ceph-devel; +Cc: Sage Weil

On 11/17/2013 11:40 PM, Li Wang wrote:
> 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(-)

Applied both, thanks!

Josh


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-25 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18  7:40 [PATCH 0/2] Fix resource leak Li Wang
2013-11-18  7:40 ` [PATCH 1/2] rbd: Release resource before return Li Wang
2013-11-18  7:40 ` [PATCH 2/2] mds: " Li Wang
2013-11-25 22:02 ` [PATCH 0/2] Fix resource leak Josh Durgin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.