Skip to content

Commit

Permalink
free is good
Browse files Browse the repository at this point in the history
  • Loading branch information
codekitchen committed Nov 26, 2019
1 parent 1d6aa67 commit 7801beb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ void termput1(char *cmd, int arg1) {

void read_show_output(FILE *s, size_t *shown, size_t *total) {
termput0("cd");
char *line = NULL;
size_t len = 0;
for (;;) {
char *line = NULL;
size_t len = 0;
ssize_t read = getline(&line, &len, s);
if (read < 0)
break;
Expand All @@ -71,6 +71,8 @@ void read_show_output(FILE *s, size_t *shown, size_t *total) {
}
*total += 1;
}
if (line)
free(line);
}

int read_command(const char *command, size_t *shown, size_t *total) {
Expand Down

0 comments on commit 7801beb

Please sign in to comment.