From 5a78cd810f68cbfad436ca2ce007112163990458 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 23 Nov 2014 18:21:56 +0000 Subject: correctly release source data from llcache --- content/fs_backing_store.c | 6 +++--- content/llcache.c | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'content') diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c index 629ea2a9e..08a1ddd23 100644 --- a/content/fs_backing_store.c +++ b/content/fs_backing_store.c @@ -1329,7 +1329,7 @@ static nserror entry_release_alloc(struct store_entry_element *elem) * Retrive an object from the backing store. * * @param[in] url The url is used as the unique primary key for the data. - * @param[in] flags The flags to control how the object is retrieved. + * @param[in] bsflags The flags to control how the object is retrieved. * @param[out] data_out The objects data. * @param[out] datalen_out The length of the \a data retrieved. * @return NSERROR_OK on success or error code on faliure. @@ -1437,8 +1437,8 @@ fetch(nsurl *url, /** * release a previously fetched or stored memory object. * - * @param url The url is used as the unique primary key to invalidate. - * @param[in] flags The flags to control how the object data is released. + * @param[in] url The url is used as the unique primary key to invalidate. + * @param[in] bsflags The flags to control how the object data is released. * @return NSERROR_OK on success or error code on faliure. */ static nserror release(nsurl *url, enum backing_store_flags bsflags) diff --git a/content/llcache.c b/content/llcache.c index b8dc24df0..c786ad02d 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -891,8 +891,15 @@ static nserror llcache_object_destroy(llcache_object *object) LLCACHE_LOG(("Destroying object %p", object)); + if (object->source_data != NULL) { + if (object->store_state == LLCACHE_STATE_DISC) { + guit->llcache->release(object->url, BACKING_STORE_NONE); + } else { + free(object->source_data); + } + } + nsurl_unref(object->url); - free(object->source_data); if (object->fetch.fetch != NULL) { fetch_abort(object->fetch.fetch); -- cgit v1.2.3