backend_chromium: fix use-after-free

It's a regression in commit bdfa812d79.
This commit is contained in:
CismonX 2025-03-29 13:22:52 +08:00
parent 44100f8852
commit c9ccc4f6df
No known key found for this signature in database
GPG key ID: 3094873E29A482FB

View file

@ -2238,6 +2238,10 @@ bookmark_delete (
}
}
// Remove from store
json_t *siblings = parent_entry->children;
json_array_remove(siblings, json_array_search(siblings, entry->node));
// Remove from maps
long guidmap_entry_id = lctx.entry_id;
if (!(ctx->flags & BACKEND_FILENAME_GUID)) {
@ -2248,10 +2252,6 @@ bookmark_delete (
hashmap_delete(ctx->id_map, entry, -1);
free(entry);
// Remove from store
json_t *siblings = parent_entry->children;
json_array_remove(siblings, json_array_search(siblings, entry->node));
ctx->dirty = DIRTY_LEVEL_DATA;
node_mtime_now(parent_entry->node, NULL);