Blame SOURCES/cyrus-imapd-close_backup_on_failure.patch

0f9cf8
From 5d00f649b4d2a599905d1b9290c91a769909741d Mon Sep 17 00:00:00 2001
0f9cf8
From: Pavel Zhukov <pzhukov@redhat.com>
0f9cf8
Date: Mon, 24 Sep 2018 17:24:48 +0200
0f9cf8
Subject: [PATCH] Close backup on failure.
0f9cf8
0f9cf8
Static analizers report this as memory leak issue.
0f9cf8
---
0f9cf8
 backup/ctl_backups.c | 3 +++
0f9cf8
 1 file changed, 3 insertions(+)
0f9cf8
0f9cf8
diff --git a/backup/ctl_backups.c b/backup/ctl_backups.c
0f9cf8
index 3d817e743..e532eedb7 100644
0f9cf8
--- a/backup/ctl_backups.c
0f9cf8
+++ b/backup/ctl_backups.c
0f9cf8
@@ -955,6 +955,7 @@ static int lock_run_pipe(const char *userid, const char *fname,
0f9cf8
 
0f9cf8
     if (r) {
0f9cf8
         printf("NO failed (%s)\n", error_message(r));
0f9cf8
+        r = backup_close(&backup);
0f9cf8
         return EC_SOFTWARE; // FIXME would something else be more appropriate?
0f9cf8
     }
0f9cf8
 
0f9cf8
@@ -993,6 +994,7 @@ static int lock_run_sqlite(const char *userid, const char *fname,
0f9cf8
         fprintf(stderr, "unable to lock %s: %s\n",
0f9cf8
                 userid ? userid : fname,
0f9cf8
                 error_message(r));
0f9cf8
+        r = backup_close(&backup);
0f9cf8
         return EC_SOFTWARE;
0f9cf8
     }
0f9cf8
 
0f9cf8
@@ -1053,6 +1055,7 @@ static int lock_run_exec(const char *userid, const char *fname,
0f9cf8
         fprintf(stderr, "unable to lock %s: %s\n",
0f9cf8
                 userid ? userid : fname,
0f9cf8
                 error_message(r));
0f9cf8
+        r = backup_close(&backup);
0f9cf8
         return EC_SOFTWARE;
0f9cf8
     }
0f9cf8