Do not leak lang files fd's

master
Yevgen Muntyan 2007-03-29 23:27:55 -05:00
parent f10663d583
commit aa641ba8b2
2 changed files with 8 additions and 3 deletions

View File

@ -34,7 +34,7 @@
</configure>
</optimized>
</configurations>
<file_selector_dir>/home/muntyan/projects/gap/gap4r4/src/</file_selector_dir>
<file_selector_dir>/home/muntyan/projects/moo/</file_selector_dir>
<run>
<args>--g-fatal-warnings --new-app --mode=project</args>
<exe>medit/medit</exe>

View File

@ -34,6 +34,7 @@
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <libxml/xmlreader.h>
#include <glib/gstdio.h>
#include "gtksourceview-i18n.h"
@ -1582,7 +1583,7 @@ file_parse (gchar *filename,
ParserState *parser_state;
xmlTextReader *reader = NULL;
int ret;
int fd;
int fd = -1;
GError *tmp_error = NULL;
GtkSourceLanguagesManager *lm;
const gchar *rng_lang_schema;
@ -1666,9 +1667,13 @@ file_parse (gchar *filename,
if (tmp_error != NULL)
goto error;
close (fd);
return TRUE;
error:
if (fd != -1)
close (fd);
g_propagate_error (error, tmp_error);
return FALSE;
}