fix(01): Memory leaks, conditional jumps on uninitialized values
This commit is contained in:
parent
09fb2aea68
commit
deac11eb54
@ -106,13 +106,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
// LCOV_EXCL_STOP
|
// LCOV_EXCL_STOP
|
||||||
|
|
||||||
char *line;
|
char *line = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
ssize_t read;
|
ssize_t read = 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
while ((read = getline(&line, &len, file) != -1)) {
|
while ((read = getline(&line, &len, file) != -1)) {
|
||||||
result += getVal(line);
|
result += getVal(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(line);
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
printf("The sum of the calibration values is %d\n", result);
|
printf("The sum of the calibration values is %d\n", result);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user