From 9beb5cee3a780b1e49ac58f7c779288ba0df6c55 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 30 Apr 2020 11:04:55 -0400 Subject: [PATCH] use delete[] instead of delete. --- src/zm_ffmpeg_input.cpp | 6 +++++- src/zm_user.cpp | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/zm_ffmpeg_input.cpp b/src/zm_ffmpeg_input.cpp index 45128645c..a6844d6a3 100644 --- a/src/zm_ffmpeg_input.cpp +++ b/src/zm_ffmpeg_input.cpp @@ -15,7 +15,11 @@ FFmpeg_Input::FFmpeg_Input() { FFmpeg_Input::~FFmpeg_Input() { if ( streams ) { - delete streams; + for ( unsigned int i = 0; i < input_format_context->nb_streams; i += 1 ) { + avcodec_close(streams[i].context); + streams[i].context = NULL; + } + delete[] streams; streams = NULL; } } diff --git a/src/zm_user.cpp b/src/zm_user.cpp index 0ad9f0672..623982fe9 100644 --- a/src/zm_user.cpp +++ b/src/zm_user.cpp @@ -107,14 +107,18 @@ User *zmLoadUser(const char *username, const char *password) { mysql_real_escape_string(&dbconn, safer_username, username, username_length); snprintf(sql, sizeof(sql), - "SELECT `Id`, `Username`, `Password`, `Enabled`, `Stream`+0, `Events`+0, `Control`+0, `Monitors`+0, `System`+0, `MonitorIds`" - " FROM `Users` WHERE `Username` = '%s' AND `Enabled` = 1", safer_username); + "SELECT `Id`, `Username`, `Password`, `Enabled`," + " `Stream`+0, `Events`+0, `Control`+0, `Monitors`+0, `System`+0," + " `MonitorIds`" + " FROM `Users` WHERE `Username` = '%s' AND `Enabled` = 1", + safer_username); + delete[] safer_username; + safer_username = NULL; if ( mysql_query(&dbconn, sql) ) { Error("Can't run query: %s", mysql_error(&dbconn)); exit(mysql_errno(&dbconn)); } - delete safer_username; MYSQL_RES *result = mysql_store_result(&dbconn); if ( !result ) {