summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-01-13 13:16:13 +0100
committerantirez <antirez@gmail.com>2020-01-13 13:16:15 +0100
commitbaa88a1c144954469e3762023fb41617242dc30e (patch)
treedd6bc74592e6467a9894544388975ba1feb48131
parentd28948b14303fdf00b331090ef177cc6cca54fe1 (diff)
downloadredis-baa88a1c144954469e3762023fb41617242dc30e.tar.gz
Jump to right label on AOF parsing error.
Related to #6054.
-rw-r--r--src/aof.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/aof.c b/src/aof.c
index 9c2fa838b..63b34b43f 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -789,12 +789,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);