From 2975fac4d0890cff0da10f102377797a103f0f3f Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Sat, 22 Feb 2020 17:49:11 +0000 Subject: [PATCH] Fix leaks in stdio-wrap --- stdio-wrap.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stdio-wrap.hpp b/stdio-wrap.hpp index a6ba68b..426940f 100644 --- a/stdio-wrap.hpp +++ b/stdio-wrap.hpp @@ -25,7 +25,10 @@ inline wrap_FILE *wrap_fopen(const char *filename, const char *mode) ret->getc_buf_len = ret->getc_buf_off = 0; if(!ret->file.is_open()) + { + delete ret; return nullptr; + } return ret; } @@ -33,6 +36,7 @@ inline wrap_FILE *wrap_fopen(const char *filename, const char *mode) inline int wrap_fclose(wrap_FILE *file) { file->file.close(); + delete file; return 0; }