Merge pull request #166 from moshekaplan/patch-2

Prevent filehandle from leaking
This commit is contained in:
sudonim1 2014-07-30 17:42:01 +01:00
commit 5415fb361f
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;
} }