Author: abroekhuis
Date: Fri Jun 27 10:44:32 2014
New Revision: 1606018

URL: http://svn.apache.org/r1606018
Log:
CELIX-119: Memory leak fixes.

Modified:
    incubator/celix/trunk/framework/private/src/bundle.c
    incubator/celix/trunk/framework/private/src/bundle_archive.c
    incubator/celix/trunk/framework/private/src/bundle_context.c
    incubator/celix/trunk/framework/private/src/bundle_revision.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/manifest.c
    incubator/celix/trunk/framework/private/src/manifest_parser.c
    incubator/celix/trunk/framework/private/src/module.c
    incubator/celix/trunk/framework/private/src/resolver.c
    incubator/celix/trunk/framework/private/src/service_registration.c
    incubator/celix/trunk/framework/private/src/service_registry.c
    incubator/celix/trunk/framework/private/src/version.c
    incubator/celix/trunk/framework/private/src/wire.c
    incubator/celix/trunk/shell_tui/private/src/shell_tui.c

Modified: incubator/celix/trunk/framework/private/src/bundle.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Fri Jun 27 10:44:32 
2014
@@ -129,6 +129,8 @@ celix_status_t bundle_destroy(bundle_pt 
        arrayList_destroy(bundle->modules);
        celixThreadMutex_destroy(&bundle->lock);
 
+       free(bundle);
+
        return CELIX_SUCCESS;
 }
 
@@ -223,10 +225,12 @@ celix_status_t bundle_createModule(bundl
         if (status == CELIX_SUCCESS) {
                        int revision = 0;
                        char moduleId[512];
+                       char *mId;
 
                        snprintf(moduleId, sizeof(moduleId), "%ld.%d", 
bundleId, revision);
-
-                       *module = module_create(headerMap, strdup(moduleId), 
bundle);
+                       mId = strdup(moduleId);
+                       *module = module_create(headerMap, mId, bundle);
+                       free(mId);
 
                        if (*module != NULL) {
                                version_pt bundleVersion = 
module_getVersion(*module);

Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Fri Jun 27 
10:44:32 2014
@@ -143,9 +143,10 @@ celix_status_t bundleArchive_destroy(bun
             bundle_revision_pt rev = linkedListIterator_next(iter);
             bundleRevision_destroy(rev);
            }
-
+           linkedListIterator_destroy(iter);
                linkedList_destroy(archive->revisions);
        }
+       free(archive);
        archive = NULL;
 
        framework_logIfError(logger, status, NULL, "Could not create archive");
@@ -190,9 +191,11 @@ celix_status_t bundleArchive_recreate(ch
 
             status = CELIX_DO_IF(status, 
bundleArchive_getRevisionLocation(archive, 0, &location));
             status = CELIX_DO_IF(status, bundleArchive_reviseInternal(archive, 
true, idx, location, NULL));
+            free(location);
             if (status == CELIX_SUCCESS) {
                 *bundle_archive = archive;
             }
+            closedir(archive->archiveRootDir);
                }
        }
 

Modified: incubator/celix/trunk/framework/private/src/bundle_context.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_context.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_context.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_context.c Fri Jun 27 
10:44:32 2014
@@ -60,6 +60,8 @@ celix_status_t bundleContext_create(apr_
 celix_status_t bundleContext_destroy(bundle_context_pt context) {
        celix_status_t status = CELIX_SUCCESS;
 
+       free(context);
+
        if (context != NULL) {
                context = NULL;
        } else {

Modified: incubator/celix/trunk/framework/private/src/bundle_revision.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_revision.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_revision.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_revision.c Fri Jun 27 
10:44:32 2014
@@ -80,6 +80,10 @@ celix_status_t bundleRevision_create(fra
 
 celix_status_t bundleRevision_destroy(bundle_revision_pt revision) {
     arrayList_destroy(revision->libraryHandles);
+    manifest_destroy(revision->manifest);
+    free(revision->root);
+    free(revision->location);
+    free(revision);
        return CELIX_SUCCESS;
 }
 

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Fri Jun 27 10:44:32 
2014
@@ -271,7 +271,12 @@ celix_status_t framework_destroy(framewo
        arrayList_destroy(framework->frameworkListeners);
        }
        if(framework->requests){
-       arrayList_destroy(framework->requests);
+           int i;
+           for (i = 0; i < arrayList_size(framework->requests); i++) {
+               request_pt request = arrayList_get(framework->requests, i);
+               free(request);
+           }
+           arrayList_destroy(framework->requests);
        }
        if(framework->installedBundleMap!=NULL){
        hashMap_destroy(framework->installedBundleMap, false, false);
@@ -854,25 +859,32 @@ celix_status_t fw_stopBundle(framework_p
                     status = CELIX_DO_IF(status, 
activator->destroy(activator->userData, context));
                 }
                }
-           }
+//         }
 
-           status = CELIX_DO_IF(status, bundle_getCurrentModule(bundle, 
&module));
-           if (status == CELIX_SUCCESS) {
-            if (strcmp(module_getId(module), "0") != 0) {
-                if (activator != NULL) {
-                    activator->start = NULL;
-                    activator->stop = NULL;
-                    activator->userData = NULL;
-                    //free(activator);
-                    status = CELIX_DO_IF(status, bundle_setActivator(bundle, 
NULL));
-                }
+//         status = CELIX_DO_IF(status, bundle_getCurrentModule(bundle, 
&module));
+//         if (status == CELIX_SUCCESS) {
+//            if (strcmp(module_getId(module), "0") != 0) {
+//                if (activator != NULL) {
+//                    activator->start = NULL;
+//                    activator->stop = NULL;
+//                    activator->userData = NULL;
+//                    //free(activator);
+////                    status = CELIX_DO_IF(status, 
bundle_setActivator(bundle, NULL));
+//                }
 
+            if (id != 0) {
                 status = CELIX_DO_IF(status, 
serviceRegistry_unregisterServices(framework->registry, bundle));
                 if (status == CELIX_SUCCESS) {
                     serviceRegistry_ungetServices(framework->registry, bundle);
                 }
                 // #TODO remove listeners for bundle
 
+//                if (wasActive) {
+//                    if (activator->destroy != NULL) {
+//                        status = CELIX_DO_IF(status, 
activator->destroy(activator->userData, context));
+//                    }
+//                }
+
                 if (context != NULL) {
                     status = CELIX_DO_IF(status, 
bundleContext_destroy(context));
                     status = CELIX_DO_IF(status, bundle_setContext(bundle, 
NULL));
@@ -881,6 +893,17 @@ celix_status_t fw_stopBundle(framework_p
                 status = CELIX_DO_IF(status, 
framework_setBundleStateAndNotify(framework, bundle, 
OSGI_FRAMEWORK_BUNDLE_RESOLVED));
             }
            }
+
+//         if (id == 0) {
+//            if (activator->destroy != NULL) {
+//                status = CELIX_DO_IF(status, 
activator->destroy(activator->userData, context));
+//            }
+//        }
+
+           if (activator != NULL) {
+               bundle_setActivator(bundle, NULL);
+               free(activator);
+           }
        }
 
        framework_releaseBundleLock(framework, bundle);
@@ -1367,6 +1390,9 @@ void fw_addServiceListener(framework_pt 
                arrayList_destroy(infos);
        }
 
+       if (info->filter != NULL) {
+           free(info->filter);
+       }
        free(info);
 
        arrayList_destroy(listenerHooks);
@@ -1427,6 +1453,7 @@ void fw_removeServiceListener(framework_
                }
 
                arrayList_destroy(listenerHooks);
+        free(info);
        }
 }
 
@@ -1540,6 +1567,7 @@ void fw_serviceChanged(framework_pt fram
 
                                
element->listener->serviceChanged(element->listener, event);
 
+                               serviceReference_destroy(event->reference);
                                free(event);
                                //TODO cleanup service reference
 
@@ -1654,8 +1682,11 @@ celix_status_t framework_markResolvedMod
                        char *mname = NULL;
                        module_getSymbolicName(module, &mname);
                        framework_markBundleResolved(framework, module);
+                       linkedListIterator_remove(iterator);
+                       free(iw);
                }
                linkedListIterator_destroy(iterator);
+               linkedList_destroy(resolvedModuleWireMap);
        }
        return CELIX_SUCCESS;
 }
@@ -2153,6 +2184,8 @@ static void *fw_eventDispatcher(void *fw
                                        event->type = request->eventType;
 
                                        fw_invokeBundleListener(framework, 
listener->listener, event, listener->bundle);
+
+                                       free(event);
                                } else if (request->type == 
FRAMEWORK_EVENT_TYPE) {
                                        fw_framework_listener_pt listener = 
(fw_framework_listener_pt) arrayList_get(request->listeners, i);
                                        framework_event_pt event = 
(framework_event_pt) malloc(sizeof(*event));
@@ -2162,6 +2195,8 @@ static void *fw_eventDispatcher(void *fw
                                        event->errorCode = request->errorCode;
 
                                        fw_invokeFrameworkListener(framework, 
listener->listener, event, listener->bundle);
+
+                                       free(event);
                                }
                        }
                }

Modified: incubator/celix/trunk/framework/private/src/manifest.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest.c Fri Jun 27 10:44:32 
2014
@@ -53,10 +53,11 @@ celix_status_t manifest_create(manifest_
 
 celix_status_t manifest_destroy(manifest_pt manifest) {
        if (manifest != NULL) {
-               properties_destroy(manifest->mainAttributes);
-               hashMap_destroy(manifest->attributes, false, false);
+           hashMap_destroy(manifest->mainAttributes, true, true);
+               hashMap_destroy(manifest->attributes, true, false);
                manifest->mainAttributes = NULL;
                manifest->attributes = NULL;
+               free(manifest);
                manifest = NULL;
        }
        return CELIX_SUCCESS;

Modified: incubator/celix/trunk/framework/private/src/manifest_parser.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest_parser.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest_parser.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest_parser.c Fri Jun 27 
10:44:32 2014
@@ -193,6 +193,7 @@ static linked_list_pt manifestParser_par
                 linkedList_addElement(paths, strdup(piece));
                 pathCount++;
             }
+            free(piece);
         }
 
         if (pathCount == 0) {
@@ -250,6 +251,8 @@ static linked_list_pt manifestParser_par
         }
     }
 
+    linkedList_destroy(pieces);
+
        return clause;
 }
 
@@ -265,12 +268,16 @@ static linked_list_pt manifestParser_par
                 return NULL;
             }
 
-            clauseStrings = 
manifestParser_parseDelimitedString(strdup(header), ",");
+            char *hdr = strdup(header);
+            clauseStrings = manifestParser_parseDelimitedString(hdr, ",");
+            free(hdr);
             if (clauseStrings != NULL) {
                 for (i = 0; i < linkedList_size(clauseStrings); i++) {
                     clauseString = (char *) linkedList_get(clauseStrings, i);
                     linkedList_addElement(completeList, 
manifestParser_parseStandardHeaderClause(clauseString));
+                    free(clauseString);
                 }
+                linkedList_destroy(clauseStrings);
             }
                }
        }

Modified: incubator/celix/trunk/framework/private/src/module.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/module.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/module.c (original)
+++ incubator/celix/trunk/framework/private/src/module.c Fri Jun 27 10:44:32 
2014
@@ -114,8 +114,22 @@ void module_destroy(module_pt module) {
 
        linkedList_destroy(module->capabilities);
        linkedList_destroy(module->requirements);
+       version_destroy(module->version);
+
+       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->headerMap = NULL;
+
+       free(module->id);
+       free(module->symbolicName);
+       free(module);
 }
 
 wire_pt module_getWire(module_pt module, char * serviceName) {

Modified: incubator/celix/trunk/framework/private/src/resolver.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/resolver.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/resolver.c (original)
+++ incubator/celix/trunk/framework/private/src/resolver.c Fri Jun 27 10:44:32 
2014
@@ -81,10 +81,12 @@ linked_list_pt resolver_resolve(module_p
                                linked_list_iterator_pt candSetIter = 
linkedListIterator_create(value, 0);
                                while (linkedListIterator_hasNext(candSetIter)) 
{
                                        candidate_set_pt set = 
linkedListIterator_next(candSetIter);
+                                       linkedList_destroy(set->candidates);
                                        free(set);
                                        linkedListIterator_remove(candSetIter);
                                }
                                linkedListIterator_destroy(candSetIter);
+                               linkedList_destroy(value);
                        }
                }
                hashMapIterator_destroy(iter);
@@ -105,9 +107,12 @@ linked_list_pt resolver_resolve(module_p
                        linked_list_iterator_pt candSetIter = 
linkedListIterator_create(value, 0);
                        while (linkedListIterator_hasNext(candSetIter)) {
                                candidate_set_pt set = 
linkedListIterator_next(candSetIter);
+                               linkedList_destroy(set->candidates);
                                free(set);
+                               linkedListIterator_remove(candSetIter);
                        }
                        linkedListIterator_destroy(candSetIter);
+                       linkedList_destroy(value);
                }
        }
        hashMapIterator_destroy(iter);
@@ -175,14 +180,15 @@ int resolver_populateCandidatesMap(hash_
                         }
 
                         if (linkedList_size(candidates) == 0) {
-                                if (linkedList_create(&invalid) == 
CELIX_SUCCESS) {
-                                                                       char 
*name = NULL;
-                                    
resolver_removeInvalidCandidate(targetModule, candidatesMap, invalid);
-                                    
-                                    module_getSymbolicName(targetModule, 
&name);
+                            if (linkedList_create(&invalid) == CELIX_SUCCESS) {
+                                char *name = NULL;
+                                resolver_removeInvalidCandidate(targetModule, 
candidatesMap, invalid);
 
-                                    printf("Unable to resolve: %s, %s\n", 
name, targetName);
+                                module_getSymbolicName(targetModule, &name);
+
+                                printf("Unable to resolve: %s, %s\n", name, 
targetName);
                             }
+                            linkedList_destroy(candidates);
                             return -1;
                         } else if (linkedList_size(candidates) > 0) {
                             candidate_set_pt cs = (candidate_set_pt) 
malloc(sizeof(*cs));
@@ -364,6 +370,7 @@ void resolver_moduleResolved(module_pt m
                     }
                 }
 
+                linkedList_destroy(capsCopy);
            }
        }
 }
@@ -386,37 +393,45 @@ linked_list_pt resolver_populateWireMap(
     linked_list_pt serviceWires;
     linked_list_pt emptyWires;
        bundle_pt bundle = NULL;
+       bool resolved = false;
 
        bundle = module_getBundle(importer);
 
     if (candidates && importer && wireMap) {
         linked_list_pt candSetList = NULL;
                if (module_isResolved(importer)) {
-            return wireMap;
+                   // already resolved
+                   resolved = true;
         }
-               linked_list_iterator_pt wit = 
linkedListIterator_create(wireMap, 0);
-               while (linkedListIterator_hasNext(wit)) {
-                   importer_wires_pt iw = linkedListIterator_next(wit);
-                   if (iw->importer == importer) {
-                       return wireMap;
-                   }
-               }
+               if (!resolved) {
+                   bool self = false;
+            linked_list_iterator_pt wit = linkedListIterator_create(wireMap, 
0);
+            while (linkedListIterator_hasNext(wit)) {
+                importer_wires_pt iw = linkedListIterator_next(wit);
+                if (iw->importer == importer) {
+                    // Do not resolve yourself
+                    self = true;
+                    break;
+                }
+            }
+            linkedListIterator_destroy(wit);
 
-        candSetList = (linked_list_pt) hashMap_get(candidates, importer);
+            if (!self) {
+                candSetList = (linked_list_pt) hashMap_get(candidates, 
importer);
 
                 if (linkedList_create(&serviceWires) == CELIX_SUCCESS) {
-                    if (linkedList_create(&emptyWires) == CELIX_SUCCESS) {
+//                    if (linkedList_create(&emptyWires) == CELIX_SUCCESS) {
                         int candSetIdx = 0;
-                                               
-                                               // hashMap_put(wireMap, 
importer, emptyWires);
+
+                        // hashMap_put(wireMap, importer, emptyWires);
 
                         char *mname = NULL;
                         module_getSymbolicName(importer, &mname);
 
-                                               importer_wires_pt importerWires 
= malloc(sizeof(*importerWires));
-                                               importerWires->importer = 
importer;
-                                               importerWires->wires = 
emptyWires;
-                                               linkedList_addElement(wireMap, 
importerWires);
+                        importer_wires_pt importerWires = 
malloc(sizeof(*importerWires));
+                        importerWires->importer = importer;
+                        importerWires->wires = NULL;
+                        linkedList_addElement(wireMap, importerWires);
                         
                         for (candSetIdx = 0; candSetIdx < 
linkedList_size(candSetList); candSetIdx++) {
                             candidate_set_pt cs = (candidate_set_pt) 
linkedList_get(candSetList, candSetIdx);
@@ -437,8 +452,10 @@ linked_list_pt resolver_populateWireMap(
 
                         importerWires->wires = serviceWires;
                         // hashMap_put(wireMap, importer, serviceWires);
-                    }
-        }
+//                    }
+                }
+            }
+               }
     }
 
     return wireMap;

Modified: incubator/celix/trunk/framework/private/src/service_registration.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registration.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c 
(original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Fri Jun 
27 10:44:32 2014
@@ -86,6 +86,7 @@ celix_status_t serviceRegistration_creat
 }
 
 celix_status_t serviceRegistration_destroy(service_registration_pt 
registration) {
+    free(registration->className);
        registration->className = NULL;
        registration->registry = NULL;
 
@@ -94,7 +95,6 @@ celix_status_t serviceRegistration_destr
 
        celixThreadMutex_destroy(&registration->mutex);
 
-       free(registration->className);
        free(registration);
 
        return CELIX_SUCCESS;

Modified: incubator/celix/trunk/framework/private/src/service_registry.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registry.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registry.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registry.c Fri Jun 27 
10:44:32 2014
@@ -476,6 +476,7 @@ void serviceRegistry_ungetServices(servi
                while (ungetResult) {
                        serviceRegistry_ungetService(registry, bundle, 
reference, &ungetResult);
                }
+               serviceReference_destroy(reference);
        }
 
        arrayList_destroy(fusages);

Modified: incubator/celix/trunk/framework/private/src/version.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version.c (original)
+++ incubator/celix/trunk/framework/private/src/version.c Fri Jun 27 10:44:32 
2014
@@ -100,6 +100,7 @@ celix_status_t version_destroy(version_p
        version->micro = 0;
        free(version->qualifier);
        version->qualifier = NULL;
+       free(version);
        return CELIX_SUCCESS;
 }
 
@@ -109,7 +110,7 @@ celix_status_t version_createVersionFrom
        int major = 0;
        int minor = 0;
        int micro = 0;
-       char * qualifier = "";
+       char * qualifier = NULL;
 
        char delims[] = ".";
        char *token = NULL;
@@ -170,6 +171,11 @@ celix_status_t version_createVersionFrom
                status = version_createVersion(major, minor, micro, qualifier, 
version);
        }
 
+       if (qualifier != NULL) {
+           free(qualifier);
+       }
+
+
        framework_logIfError(logger, status, NULL, "Cannot create version 
[versionString=%s]", versionStr);
 
        return status;

Modified: incubator/celix/trunk/framework/private/src/wire.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/wire.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/wire.c (original)
+++ incubator/celix/trunk/framework/private/src/wire.c Fri Jun 27 10:44:32 2014
@@ -64,6 +64,7 @@ celix_status_t wire_destroy(wire_pt wire
        wire->requirement = NULL;
        wire->exporter = NULL;
        wire->capability = NULL;
+       free(wire);
        return CELIX_SUCCESS;
 }
 

Modified: incubator/celix/trunk/shell_tui/private/src/shell_tui.c
URL: 
http://svn.apache.org/viewvc/incubator/celix/trunk/shell_tui/private/src/shell_tui.c?rev=1606018&r1=1606017&r2=1606018&view=diff
==============================================================================
--- incubator/celix/trunk/shell_tui/private/src/shell_tui.c (original)
+++ incubator/celix/trunk/shell_tui/private/src/shell_tui.c Fri Jun 27 10:44:32 
2014
@@ -68,9 +68,11 @@ static void *APR_THREAD_FUNC shellTui_ru
                dline = strdup(in);
                line = utils_stringTrim(dline);
                if (strlen(line) == 0) {
+                   free(dline);
                        continue;
                }
                if (act->shell == NULL) {
+                   free(dline);
                        continue;
                }
                act->shell->executeCommand(act->shell->shell, line, 
shellTui_write, shellTui_write);
@@ -99,6 +101,7 @@ void shellTui_serviceChanged(service_lis
                shellTui_initializeService(act);
        } else if ((event->type == OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING) 
&& (act->reference == event->reference)) {
                bundleContext_ungetService(act->context, act->reference, 
&result);
+        serviceReference_destroy(act->reference);
                act->reference = NULL;
                act->shell = NULL;
 


Reply via email to