Fix pg_worker_list use-after-free bug

This change fixes a use-after-free bug while renaming obsolete
`pg_worker_list.conf` file, which causes Citus to crash during upgrade
(or even extension creation) if `pg_worker_list.conf` exists.
pull/1551/head
Eren Başak 2017-08-11 15:43:52 +03:00
parent b7e55e0c81
commit b3d2f9ba71
1 changed files with 3 additions and 3 deletions

View File

@ -1367,14 +1367,14 @@ ParseWorkerNodeFileAndRename()
workerNodeList = lappend(workerNodeList, workerNode);
}
FreeFile(workerFileStream);
free(workerFilePath);
/* rename the file, marking that it is not used anymore */
appendStringInfo(renamedWorkerFilePath, "%s", workerFilePath);
appendStringInfo(renamedWorkerFilePath, ".obsolete");
rename(workerFilePath, renamedWorkerFilePath->data);
FreeFile(workerFileStream);
free(workerFilePath);
return workerNodeList;
}