Skip to content

Commit

Permalink
preproc: fix possible leak when errors trigger
Browse files Browse the repository at this point in the history
Fix Coverity #199907

(cherry picked from commit 1534d26)
  • Loading branch information
razvancrainea committed Jan 29, 2020
1 parent 6743637 commit 43d4792
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cfg_pp.c
Expand Up @@ -412,6 +412,7 @@ static int __flatten_opensips_cfg(FILE *cfg, const char *cfg_path,
}

free(line);
line = NULL;

needed = cfgtok_fileend.len + 1 + 1;
if (*bytes_left < needed) {
Expand All @@ -430,6 +431,8 @@ static int __flatten_opensips_cfg(FILE *cfg, const char *cfg_path,
return 0;

out_err:
if (line)
free(line);
fclose(cfg);
return -1;
}
Expand Down

0 comments on commit 43d4792

Please sign in to comment.