From 09899fcf6c07386fbb3e11fd6a55d81d09654a18 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Fri, 30 Nov 2018 12:54:09 +0100 Subject: [PATCH] Fixed: DataMapper potentially leaking stuff when being disposed. --- src/Marr.Data/DataMapper.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Marr.Data/DataMapper.cs b/src/Marr.Data/DataMapper.cs index 51423b988..c632471cf 100644 --- a/src/Marr.Data/DataMapper.cs +++ b/src/Marr.Data/DataMapper.cs @@ -941,21 +941,21 @@ namespace Marr.Data { if (disposing) { - if (Command.Transaction != null) + if (_command != null) { - Command.Transaction.Dispose(); - Command.Transaction = null; - } + if (_command.Transaction != null) + { + _command.Transaction.Dispose(); + _command.Transaction = null; + } - if (Command.Connection != null) - { - Command.Connection.Dispose(); - Command.Connection = null; - } + if (_command.Connection != null) + { + _command.Connection.Dispose(); + _command.Connection = null; + } - if (Command != null) - { - Command.Dispose(); + _command.Dispose(); _command = null; } }