From 036d47a832383353b37af3d148dd86ff13a5e99c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 11 Nov 2021 14:42:08 -0500 Subject: [PATCH] proper fix to memleak --- src/zm_event.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index aad16a767..9f1124e7b 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -141,7 +141,6 @@ Event::Event( if (monitor->ServerId()) sql += stringtf(" AND ServerId=%u", monitor->ServerId()); - delete storage; storage = nullptr; MYSQL_RES *result = zmDbFetch(sql); @@ -218,7 +217,8 @@ Event::Event( Debug(1, "Video file is %s", video_file.c_str()); } } // end if GetOptVideoWriter - delete storage; + if (storage != monitor->getStorage()) + delete storage; } Event::~Event() {