From 6664f844cb993dd3930edfb863e0ad44cb2f27db Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Mon, 22 Mar 2021 20:07:03 -0700 Subject: [PATCH] Fix uninitialized variable warning in read_file() Silences a compiler warning. This could actually happen if the save file had no snapshots. It should always have some, but format does allow for zero, which would probably crash. --- src/serializer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/serializer.c b/src/serializer.c index e772f66..3676f29 100644 --- a/src/serializer.c +++ b/src/serializer.c @@ -532,6 +532,7 @@ int read_file(FILE *f, struct snapshot ***s, char ***names, uint64_t *cnt) if(0 != fscanf(f, " T;%n", &n) || !n) return 1; *s = NULL; *names = NULL; + *cnt = 0; for(;;) { if(scan_label(f,l)) goto error; if(!strcmp("__end__",l)) break;