+ BlueSkyFS *fs = log->fs;
+
+ g_mutex_lock(fs->lock);
+ if (g_atomic_int_get(&log->refcount) > 0) {
+ g_mutex_unlock(fs->lock);
+ return;
+ }
+
+ g_hash_table_remove(fs->locations, &log->id);
+ g_mutex_unlock(fs->lock);
+
+ log->type = LOGTYPE_INVALID;
+ g_mutex_free(log->lock);
+ g_cond_free(log->cond);
+ for (int i = 0; i < log->links->len; i++) {
+ BlueSkyCloudLog *c = g_array_index(log->links,
+ BlueSkyCloudLog *, i);
+ bluesky_cloudlog_unref(c);
+ }
+ g_array_unref(log->links);
+ bluesky_string_unref(log->data);
+ g_free(log);