diff --git a/src/openvpn/misc.c b/src/openvpn/misc.c
index 90632706..86f80a6a 100644
--- a/src/openvpn/misc.c
+++ b/src/openvpn/misc.c
@@ -724,10 +724,13 @@ const char *
 create_temp_file(const char *directory, const char *prefix, struct gc_arena *gc)
 {
     static unsigned int counter;
-    struct buffer fname = alloc_buf_gc(256, gc);
     int fd;
     const char *retfname = NULL;
     unsigned int attempts = 0;
+    struct buffer fname = (struct buffer) { 0 };
+    char buf_data[256] = { 0 };
+
+    buf_set_write(&fname, buf_data, sizeof(buf_data));
 
     do
     {
