[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] backupfile: fix resource leak on memory failure
From: |
Paul Eggert |
Subject: |
[PATCH] backupfile: fix resource leak on memory failure |
Date: |
Tue, 23 Jul 2019 12:25:40 -0700 |
Problem found by Coverity (CID 1484214).
* lib/backupfile.c (backupfile_internal): Don’t leak dirp.
---
ChangeLog | 6 ++++++
lib/backupfile.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 4b7bb2054..9b994381b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-23 Paul Eggert <address@hidden>
+
+ backupfile: fix resource leak on memory failure
+ Problem found by Coverity (CID 1484214).
+ * lib/backupfile.c (backupfile_internal): Don’t leak dirp.
+
2019-07-22 Bruno Haible <address@hidden>
Avoid missing-declarations warning in various tests.
diff --git a/lib/backupfile.c b/lib/backupfile.c
index 254c08614..82baca576 100644
--- a/lib/backupfile.c
+++ b/lib/backupfile.c
@@ -362,6 +362,8 @@ backupfile_internal (int dir_fd, char const *file,
break;
case BACKUP_NOMEM:
+ if (dirp)
+ closedir (dirp);
free (s);
errno = ENOMEM;
return NULL;
--
2.17.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] backupfile: fix resource leak on memory failure,
Paul Eggert <=