If gc == NULL, the data allocated in the alloc_gc_buf() call would never
be free'd.  The function is never called that way, but let's prevent
future problems.

Signed-off-by: Steffan Karger <stef...@karger.me>
---
 src/openvpn/misc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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
     {
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to