Prevent filehandle from leaking

This commit is contained in:
Moshe Kaplan 2014-07-23 13:51:22 -04:00
parent 8a43789db5
commit 82dd025860
1 changed files with 8 additions and 2 deletions

View File

@ -537,12 +537,16 @@ void OnCreateZ(GtkButton *button, gpointer user_data)
t = fopen(table, "wb"); t = fopen(table, "wb");
if (t == NULL) return; if (t == NULL) return;
if (CDR_open() == -1) return; if (CDR_open() == -1)
{
fclose(t);
return;
}
if (CDR_getTD(ftrack, start) == -1) if (CDR_getTD(ftrack, start) == -1)
{ {
printf("Error getting TD\n"); printf("Error getting TD\n");
CDR_close(); CDR_close();
fclose(t);
return; return;
} }
@ -550,6 +554,7 @@ void OnCreateZ(GtkButton *button, gpointer user_data)
{ {
printf("Error getting TD\n"); printf("Error getting TD\n");
CDR_close(); CDR_close();
fclose(t);
return; return;
} }
@ -557,6 +562,7 @@ void OnCreateZ(GtkButton *button, gpointer user_data)
if (f == NULL) if (f == NULL)
{ {
CDR_close(); CDR_close();
fclose(t);
printf("Error opening %s", IsoFile); printf("Error opening %s", IsoFile);
return; return;
} }