Skip to content

Commit

Permalink
Fix mem leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Jul 28, 2024
1 parent cf413fb commit f8da110
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,9 +750,6 @@ static char *read_assertion_from_file(Location error_location, const Token *star

if (t == end-1 || t[0].location.lineno != t[1].location.lineno) {
// Last token of a line. Read code from file.
char *line = malloc(oend - ostart + 1);
if (!line)
goto error;
if (fseek(f, ostart, SEEK_SET) < 0)
goto error;
if (result.len > 0)
Expand Down Expand Up @@ -780,6 +777,8 @@ static char *read_assertion_from_file(Location error_location, const Token *star
*p = ' '; // join lines with a space
}
}

fclose(f);
return result.ptr;

error:
Expand Down

0 comments on commit f8da110

Please sign in to comment.