diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 5fc7291ff69be0844f2c78978d427cdf94c69c0e..f66f5302883a7d58e8ff313aee19f74e22d60ddf 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -3309,6 +3309,7 @@ create_xlog_symlink(void)
 		fprintf(stderr, _("%s: symlinks are not supported on this platform"));
 		exit_nicely();
 #endif
+		free(linkloc);
 	}
 }