Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't increment the fileid until after the file has been opened

  • Loading branch information...
commit 80ac662cecea2511b295c2a00cee852ed37eed27 1 parent e6ff0a0
@atrodo authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 loader.c
View
7 loader.c
@@ -79,13 +79,14 @@ lorito_load_bytecode(Lorito_Interp *interp, Lorito_Str* filename)
Lorito_File *
loadbc(Lorito_Interp *interp, const char* filename)
{
- int fileid = interp->next_fileid++;
- int segid = 0;
FILE *input = fopen(filename, "rb");
if (input == NULL) {
- return;
+ return NULL;
}
+ int fileid = interp->next_fileid++;
+ int segid = 0;
+
if (fileid >= interp->allocated_file)
{
interp->allocated_file += 4;
Please sign in to comment.
Something went wrong with that request. Please try again.