Return-Path: X-Original-To: apmail-celix-commits-archive@www.apache.org Delivered-To: apmail-celix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2162D17D45 for ; Tue, 17 Feb 2015 09:30:06 +0000 (UTC) Received: (qmail 88358 invoked by uid 500); 17 Feb 2015 09:29:56 -0000 Delivered-To: apmail-celix-commits-archive@celix.apache.org Received: (qmail 88334 invoked by uid 500); 17 Feb 2015 09:29:56 -0000 Mailing-List: contact commits-help@celix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@celix.apache.org Delivered-To: mailing list commits@celix.apache.org Received: (qmail 88324 invoked by uid 99); 17 Feb 2015 09:29:56 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Feb 2015 09:29:56 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 6B87BAC00A8 for ; Tue, 17 Feb 2015 09:29:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1660329 - in /celix/trunk/framework/private/src: module.c resolver.c Date: Tue, 17 Feb 2015 09:29:56 -0000 To: commits@celix.apache.org From: abroekhuis@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150217092956.6B87BAC00A8@hades.apache.org> Author: abroekhuis Date: Tue Feb 17 09:29:55 2015 New Revision: 1660329 URL: http://svn.apache.org/r1660329 Log: CELIX-219: Fixed memory leaks in the resolver. The resolver now properly cleans up the capabilities list. Modules now destroy the wires when needed (either on a destroy, or when set to NULL by the bundle). Modified: celix/trunk/framework/private/src/module.c celix/trunk/framework/private/src/resolver.c Modified: celix/trunk/framework/private/src/module.c URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/module.c?rev=1660329&r1=1660328&r2=1660329&view=diff ============================================================================== --- celix/trunk/framework/private/src/module.c (original) +++ celix/trunk/framework/private/src/module.c Tue Feb 17 09:29:55 2015 @@ -207,8 +207,15 @@ void module_setWires(module_pt module, l } if (module->wires != NULL) { - linkedList_destroy(module->wires); - } + linked_list_iterator_pt iter = linkedListIterator_create(module->wires, 0); + while (linkedListIterator_hasNext(iter)) { + wire_pt next = linkedListIterator_next(iter); + linkedListIterator_remove(iter); + wire_destroy(next); + } + linkedListIterator_destroy(iter); + linkedList_destroy(module->wires); + } module->wires = wires; Modified: celix/trunk/framework/private/src/resolver.c URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/resolver.c?rev=1660329&r1=1660328&r2=1660329&view=diff ============================================================================== --- celix/trunk/framework/private/src/resolver.c (original) +++ celix/trunk/framework/private/src/resolver.c Tue Feb 17 09:29:55 2015 @@ -289,10 +289,16 @@ void resolver_removeModule(module_pt mod list = resolver_getCapabilityList(m_unresolvedServices, serviceName); if (list != NULL) { linkedList_removeElement(list->capabilities, cap); + linkedList_destroy(list->capabilities); + free(list->serviceName); + free(list); } list = resolver_getCapabilityList(m_resolvedServices, serviceName); if (list != NULL) { linkedList_removeElement(list->capabilities, cap); + linkedList_destroy(list->capabilities); + free(list->serviceName); + free(list); } } }