PengZheng commented on code in PR #476:
URL: https://github.com/apache/celix/pull/476#discussion_r1155443921


##########
bundles/shell/shell/src/lb_command.c:
##########
@@ -49,16 +46,68 @@ typedef struct lb_options {
     char *listGroup;
 } lb_options_t;
 
-static char * psCommand_stateString(bundle_state_e state);
+typedef struct lb_command_bundle_info {
+    long id;
+    char* name;
+    char* symbolicName;
+    celix_version_t* version;
+    char* group;
+    char* location;
+    bundle_state_e state;
+} lb_command_bundle_info_t;
+
+static int lbCommand_bundleInfoCmp(const lb_command_bundle_info_t* a, const 
lb_command_bundle_info_t* b) {
+    return (int)(a->id - b->id);
+}
+
+static void lbCommand_collectBundleInfo_callback(void* data, const 
celix_bundle_t* bnd) {
+    celix_array_list_t* infoEntries = data;
+    lb_command_bundle_info_t* info = malloc(sizeof(*info));
+    if (info != NULL) {
+        info->id = celix_bundle_getId(bnd);
+        info->name = celix_utils_strdup(celix_bundle_getName(bnd));
+        info->location = celix_utils_strdup(celix_bundle_getLocation(bnd));

Review Comment:
   `celix_bundleContext_useBundles` protects `celix_framework_bundle_entry_t` 
from being destroyed, but it does not protect it from being revised. So the 
aforementioned use-after-free remains.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to