Skip to content

Commit

Permalink
Fixed potential memory leak.
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-zago committed Jun 25, 2014
1 parent 4026ff7 commit 508ef67
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/title.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ static void read_credits(void)
j = 0;
lines = 0;
chFBuf = malloc (8000+1); /* fz-hardcoded */
if (chFBuf == 0)
if (chFBuf == NULL)
return;

gchLBuf = malloc (LINESIZE+1);
if (gchLBuf == 0)
if (gchLBuf == NULL) {
free(chFBuf);
return;
}

snprintf(filename, MAXFILENAME, "%s/CREDITS", DATADIR);
filename[MAXFILENAME-1] = '\0';
Expand Down

0 comments on commit 508ef67

Please sign in to comment.