bugfixed: sf_binlog_index.c call parse only when row_count > 0

pull/6/head
YuQing 2023-07-29 09:48:25 +08:00
parent 024a6b0e8a
commit 27a7696867
1 changed files with 3 additions and 5 deletions

View File

@ -68,10 +68,6 @@ static int parse(SFBinlogIndexContext *ctx, const string_t *lines,
const string_t *end; const string_t *end;
void *bindex; void *bindex;
if (row_count < 1) {
return EINVAL;
}
if ((result=parse_header(lines, &record_count, &ctx-> if ((result=parse_header(lines, &record_count, &ctx->
last_version, error_info)) != 0) last_version, error_info)) != 0)
{ {
@ -140,7 +136,9 @@ static int load(SFBinlogIndexContext *ctx)
} }
row_count = split_string_ex(&context, '\n', lines, row_count, true); row_count = split_string_ex(&context, '\n', lines, row_count, true);
result = parse(ctx, lines, row_count); if (row_count > 0) {
result = parse(ctx, lines, row_count);
}
free(lines); free(lines);
free(context.str); free(context.str);
return result; return result;