fix(01): Memory leaks, conditional jumps on uninitialized values

This commit is contained in:
Jiří Štefka 2023-12-11 11:58:46 +01:00
parent 09fb2aea68
commit deac11eb54
Signed by: jiriks74
GPG Key ID: 1D5E30D3DB2264DE

View File

@ -106,13 +106,17 @@ int main(int argc, char *argv[])
}
// LCOV_EXCL_STOP
char *line;
char *line = NULL;
size_t len = 0;
ssize_t read;
ssize_t read = 0;
int result = 0;
while ((read = getline(&line, &len, file) != -1)) {
result += getVal(line);
}
free(line);
fclose(file);
printf("The sum of the calibration values is %d\n", result);
return EXIT_SUCCESS;
}