From 6a4565c891ce29f33c41fe6c5d78772d65fd3899 Mon Sep 17 00:00:00 2001 From: Evgeny Gavrin Date: Tue, 7 Jul 2015 20:40:36 +0300 Subject: [PATCH] Fix resource leak at main-linux.cpp:read_sources. JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com --- main-linux.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main-linux.cpp b/main-linux.cpp index 42d66162f..a8fd1577b 100644 --- a/main-linux.cpp +++ b/main-linux.cpp @@ -68,6 +68,7 @@ read_sources (const char *script_file_names[], if (script_len < 0) { + fclose (file); break; } @@ -77,12 +78,14 @@ read_sources (const char *script_file_names[], if (source_buffer_tail + current_source_size >= source_buffer + sizeof (source_buffer)) { + fclose (file); break; } size_t bytes_read = fread (source_buffer_tail, 1, current_source_size, file); if (bytes_read < current_source_size) { + fclose (file); break; }