Message ID | 144b72fe66a7e9b851c551fd929648d470674a46.1384760071.git.liwang@ubuntukylin.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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:
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(-)