Skip to content

Commit 18f1bf9

Browse files
committed
fix double free
Signed-off-by: Ray Cao <zisong.cw@alibaba-inc.com>
1 parent 8660183 commit 18f1bf9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/aof.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,6 @@ int RestartAOFWithSyncFile(void) {
10431043
new_incr_filename = getNewIncrAofName(temp_am);
10441044
new_incr_filepath = makePath(server.aof_dirname, new_incr_filename);
10451045
newfd = open(new_incr_filepath, O_WRONLY | O_TRUNC | O_CREAT, 0644);
1046-
sdsfree(new_incr_filepath);
10471046
if (newfd == -1) {
10481047
serverLog(LL_WARNING, "Can't open the append-only file %s: %s", new_incr_filename, strerror(errno));
10491048
goto cleanup;
@@ -1065,6 +1064,7 @@ int RestartAOFWithSyncFile(void) {
10651064

10661065
/* Now, it will not goto clean up, then we can safely free new_base_filepath */
10671066
sdsfree(new_base_filepath);
1067+
sdsfree(new_incr_filepath);
10681068

10691069
/* Set the initial repl_offset, which will be applied to fsynced_reploff */
10701070
atomic_store_explicit(&server.fsynced_reploff_pending, server.primary_repl_offset, memory_order_relaxed);

0 commit comments

Comments
 (0)