From eafcca9f29b8325b67183aa7ce65516a4d998c09 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 13 Jan 2020 13:16:13 +0100 Subject: [PATCH] Jump to right label on AOF parsing error. Related to #6054. Former-commit-id: c7159d58f118e840a3b9f72160d1abf3e8a86b3d --- src/aof.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/aof.cpp b/src/aof.cpp index 291685e5c..da1ae3c14 100644 --- a/src/aof.cpp +++ b/src/aof.cpp @@ -815,12 +815,14 @@ int loadAppendOnlyFile(char *filename) { for (j = 0; j < argc; j++) { /* Parse the argument len. */ - if (fgets(buf,sizeof(buf),fp) == NULL || - buf[0] != '$') - { + char *readres = fgets(buf,sizeof(buf),fp); + if (readres == NULL || buf[0] != '$') { fakeClient->argc = j; /* Free up to j-1. */ freeFakeClientArgv(fakeClient); - goto readerr; + if (readres == NULL) + goto readerr; + else + goto fmterr; } len = strtol(buf+1,NULL,10);