dev/core#2073 Fix memory leak in well tested code
authoreileen <emcnaughton@wikimedia.org>
Wed, 7 Oct 2020 06:44:18 +0000 (19:44 +1300)
committereileen <emcnaughton@wikimedia.org>
Wed, 7 Oct 2020 06:45:06 +0000 (19:45 +1300)
Example test

api_v3_ContactTest::testSortLimitChainedRelationshipGetCRM15983

CRM/Contact/BAO/Relationship.php

index 24122a128a84b9a4ecc81227948e5ffa2ed92300..7e6c9bfef293bd386f263d994e746188ced54500 100644 (file)
@@ -983,8 +983,7 @@ WHERE  relationship_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
       $queryString .= " AND id !=" . CRM_Utils_Type::escape($relationshipId, 'Integer');
     }
 
-    $relationship = new CRM_Contact_BAO_Relationship();
-    $relationship->query($queryString);
+    $relationship = CRM_Core_DAO::executeQuery($queryString);
     while ($relationship->fetch()) {
       // Check whether the custom field values are identical.
       $result = self::checkDuplicateCustomFields($params, $relationship->id);