diff --git a/repmgr-action-node.c b/repmgr-action-node.c index bca0921e..45b27c1c 100644 --- a/repmgr-action-node.c +++ b/repmgr-action-node.c @@ -3108,11 +3108,12 @@ copy_file(const char *src_file, const char *dest_file) int a = 0; ptr_old = fopen(src_file, "r"); - ptr_new = fopen(dest_file, "w"); if (ptr_old == NULL) return false; + ptr_new = fopen(dest_file, "w"); + if (ptr_new == NULL) { fclose(ptr_old);