changeset 28197:e4d25cbc2bd7 v8.2.4624

patch 8.2.4624: old Coverity warning for resource leak Commit: https://github.com/vim/vim/commit/5d46dcfeed4fcbbab371e17e1072b0cc9abe5217 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 25 14:46:47 2022 +0000 patch 8.2.4624: old Coverity warning for resource leak Problem: Old Coverity warning for resource leak. Solution: Close the file if memory allocation fails.
author Bram Moolenaar <Bram@vim.org>
date Fri, 25 Mar 2022 16:00:03 +0100
parents f1510c70165d
children 757e2258c287
files src/diff.c src/version.c
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/diff.c
+++ b/src/diff.c
@@ -1662,7 +1662,11 @@ diff_read(
     {
 	hunk = ALLOC_ONE(diffhunk_T);
 	if (hunk == NULL)
+	{
+	    if (fd != NULL)
+		fclose(fd);
 	    return;
+	}
     }
 
     for (;;)
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4624,
+/**/
     4623,
 /**/
     4622,