fix memory leak in filter 40/147340/1
authorJongkyu Koo <jk.koo@samsung.com>
Mon, 4 Sep 2017 05:04:45 +0000 (14:04 +0900)
committerJongkyu Koo <jk.koo@samsung.com>
Mon, 4 Sep 2017 05:04:45 +0000 (14:04 +0900)
Change-Id: Ib9bbc47accee3e6cbc65c62c262998f22750726c
Signed-off-by: Jongkyu Koo <jk.koo@samsung.com>
src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsFilter.cs

index 0b53bff..826a73c 100644 (file)
@@ -49,6 +49,7 @@ namespace Tizen.Pims.Contacts
             error = Interop.Filter.ContactsFilterAddStr(_filterHandle, propertyId, matchType, matchValue);
             if ((int)ContactsError.None != error)
             {
+                Interop.Filter.ContactsFilterDestroy(_filterHandle);
                 Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error);
                 throw ContactsErrorFactory.CheckAndCreateException(error);
             }
@@ -77,6 +78,7 @@ namespace Tizen.Pims.Contacts
             error = Interop.Filter.ContactsFilterAddInt(_filterHandle, propertyId, matchType, matchValue);
             if ((int)ContactsError.None != error)
             {
+                Interop.Filter.ContactsFilterDestroy(_filterHandle);
                 Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error);
                 throw ContactsErrorFactory.CheckAndCreateException(error);
             }
@@ -105,6 +107,7 @@ namespace Tizen.Pims.Contacts
             error = Interop.Filter.ContactsFilterAddLli(_filterHandle, propertyId, matchType, matchValue);
             if ((int)ContactsError.None != error)
             {
+                Interop.Filter.ContactsFilterDestroy(_filterHandle);
                 Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error);
                 throw ContactsErrorFactory.CheckAndCreateException(error);
             }
@@ -133,6 +136,7 @@ namespace Tizen.Pims.Contacts
             error = Interop.Filter.ContactsFilterAddDouble(_filterHandle, propertyId, matchType, matchValue);
             if ((int)ContactsError.None != error)
             {
+                Interop.Filter.ContactsFilterDestroy(_filterHandle);
                 Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error);
                 throw ContactsErrorFactory.CheckAndCreateException(error);
             }
@@ -160,6 +164,7 @@ namespace Tizen.Pims.Contacts
             error = Interop.Filter.ContactsFilterAddBool(_filterHandle, propertyId, matchValue);
             if ((int)ContactsError.None != error)
             {
+                Interop.Filter.ContactsFilterDestroy(_filterHandle);
                 Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error);
                 throw ContactsErrorFactory.CheckAndCreateException(error);
             }