Commit 4a28a8de authored by anthraxx's avatar anthraxx
Browse files

some manual (unnecessery) free for good manner

its not needed because OS is responsible to cleanup
mem allocated by terminating process, but its still
a good manner to explicitly free everything that gets
allocated...
yes this is "noise" if it terminates but neither does
harm to feel being responsible to clean up everything
ourselves. :)

at least valgrind is silently happy :P :D
parent 76942f69
......@@ -14,15 +14,18 @@ int main(void) {
/* read in password from standard input, exit on error. */
if (getline(&input_line, &input_size, stdin) == -1) {
perror("Error");
free(input_line);
exit(EXIT_FAILURE);
}
/* compare password, print info, exit appropriately */
if (strcmp(input_line, password) == 0) {
puts("Success!");
free(input_line);
exit(EXIT_SUCCESS);
} else {
puts("How about no?!");
free(input_line);
exit(EXIT_FAILURE);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment