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 EC3189159 for ; Wed, 10 Dec 2014 18:37:01 +0000 (UTC) Received: (qmail 4243 invoked by uid 500); 10 Dec 2014 18:37:01 -0000 Delivered-To: apmail-celix-commits-archive@celix.apache.org Received: (qmail 4212 invoked by uid 500); 10 Dec 2014 18:37:01 -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 4201 invoked by uid 99); 10 Dec 2014 18:37:01 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Dec 2014 18:37:01 +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 A1D19AC0946; Wed, 10 Dec 2014 18:36:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1644502 - in /celix/trunk/remote_services: discovery/private/src/endpoint_discovery_poller.c topology_manager/private/src/activator.c Date: Wed, 10 Dec 2014 18:36:56 -0000 To: commits@celix.apache.org From: bpetri@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141210183656.A1D19AC0946@hades.apache.org> Author: bpetri Date: Wed Dec 10 18:36:55 2014 New Revision: 1644502 URL: http://svn.apache.org/r1644502 Log: CELIX-190: fixed minor memory leak Modified: celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c celix/trunk/remote_services/topology_manager/private/src/activator.c Modified: celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c?rev=1644502&r1=1644501&r2=1644502&view=diff ============================================================================== --- celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c (original) +++ celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c Wed Dec 10 18:36:55 2014 @@ -190,17 +190,16 @@ celix_status_t endpointDiscoveryPoller_r return CELIX_BUNDLE_EXCEPTION; } - hash_map_entry_pt endpointEntry = hashMap_remove(poller->entries, url); - - free(hashMapEntry_getKey(endpointEntry)); - array_list_pt entries = hashMapEntry_getValue(endpointEntry); + array_list_pt entries = hashMap_remove(poller->entries, url); for (int i = 0; i < arrayList_size(entries); i++) { endpoint_description_pt endpoint = arrayList_get(entries, i); - discovery_removeDiscoveredEndpoint(poller->discovery, endpoint); } - arrayList_destroy(entries); + + if (entries != NULL) { + arrayList_destroy(entries); + } status = celixThreadMutex_unlock(&poller->pollerLock); Modified: celix/trunk/remote_services/topology_manager/private/src/activator.c URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/topology_manager/private/src/activator.c?rev=1644502&r1=1644501&r2=1644502&view=diff ============================================================================== --- celix/trunk/remote_services/topology_manager/private/src/activator.c (original) +++ celix/trunk/remote_services/topology_manager/private/src/activator.c Wed Dec 10 18:36:55 2014 @@ -57,6 +57,7 @@ celix_status_t bundleActivator_create(bu struct activator *activator = NULL; activator = malloc(sizeof(struct activator)); + if (!activator) { return CELIX_ENOMEM; } @@ -173,6 +174,7 @@ celix_status_t bundleActivator_stop(void struct activator *activator = userData; serviceTracker_close(activator->remoteServiceAdminTracker); + serviceTracker_destroy(activator->remoteServiceAdminTracker); bundleContext_removeServiceListener(context, activator->serviceListener); @@ -183,10 +185,16 @@ celix_status_t bundleActivator_stop(void } celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) { + celix_status_t status = CELIX_SUCCESS; + struct activator *activator = userData; if (!activator || !activator->manager) { - return CELIX_BUNDLE_EXCEPTION; + status = CELIX_BUNDLE_EXCEPTION; + } + else { + status = topologyManager_destroy(activator->manager); + free(activator); } - return topologyManager_destroy(activator->manager); + return status; }