[gtksourceview] language: fix Coverity defect
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] language: fix Coverity defect
- Date: Sun, 22 Jan 2017 10:49:07 +0000 (UTC)
commit 4bef25165be650868af6a365243bffb74e256e3d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Jan 22 11:44:43 2017 +0100
language: fix Coverity defect
In practice, I'm not sure that fd can be leaked in that code path, but
in theory it can happen, so handle the case.
gtksourceview/gtksourcelanguage.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcelanguage.c b/gtksourceview/gtksourcelanguage.c
index 15cfc44..10a8431 100644
--- a/gtksourceview/gtksourcelanguage.c
+++ b/gtksourceview/gtksourcelanguage.c
@@ -123,8 +123,12 @@ _gtk_source_language_new_from_file (const gchar *filename,
}
else
{
- g_warning("Unable to open '%s'", filename);
+ g_warning ("Unable to open '%s'", filename);
+ if (fd != -1)
+ {
+ close (fd);
+ }
}
if (lang != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]