commit b5652fabcf0db0189fe09f792b7a3ec160783e84
parent 09afe25d62295c1f2affcb039e13b8254eae874e
Author: Frederic Cambus <fred@statdns.com>
Date: Fri, 19 Oct 2018 13:39:29 +0200
If readComments() fail, set record->comments to 0
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/sauce.c b/src/sauce.c
@@ -81,7 +81,9 @@ void readRecord(FILE *file, sauce *record)
record->comment_lines = malloc(record->comments *sizeof (*record->comment_lines));
if (record->comment_lines != NULL) {
- readComments(file, record->comment_lines, record->comments);
+ if (readComments(file, record->comment_lines, record->comments != 0)) {
+ record->comments = 0;
+ }
} else {
free(record);
return;