Skip to content

Commit

Permalink
fix: "uninitialized value was created by a heap allocation" error
Browse files Browse the repository at this point in the history
  • Loading branch information
alioguzhan committed Nov 2, 2020
1 parent 9e67ab3 commit bd9badb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/stop.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ int stop_task(int argc, char const *argv[])
original_file_size = ftell(file); // get the file size
fseek(file, 0, SEEK_SET); // rollback to the start of the file

char *new_file = NULL;
new_file = (char *)malloc(sizeof(char) * original_file_size); // allocate memory for the new file
assert(new_file); // check if allocation failed
char *new_file = (char *)calloc(1, sizeof(char) * original_file_size); // allocate memory for the new file
assert(new_file); // check if allocation failed

int line_count = 0; // store the total lines in the file
char *line = NULL;
Expand Down

0 comments on commit bd9badb

Please sign in to comment.