correctly release source data from llcache

This commit is contained in:
Vincent Sanders 2014-11-23 18:21:56 +00:00
parent 01b2bc5a57
commit 5a78cd810f
2 changed files with 11 additions and 4 deletions

View File

@ -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)

View File

@ -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);