From: Michael Vrable Date: Thu, 21 Oct 2010 05:34:45 +0000 (-0700) Subject: Fix a memory leak resulting from the in-memory inode map. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=4536000021cb67fb248317392336f69c7c045754;p=bluesky.git Fix a memory leak resulting from the in-memory inode map. Actually release the reference to the old version of an inode when creating a new one. --- diff --git a/bluesky/cloudlog.c b/bluesky/cloudlog.c index b2f95c7..116195c 100644 --- a/bluesky/cloudlog.c +++ b/bluesky/cloudlog.c @@ -392,6 +392,7 @@ BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log, g_mutex_lock(fs->lock); InodeMapEntry *entry = bluesky_inode_map_lookup(fs->inode_map, log->inum, 1); + bluesky_cloudlog_unref_delayed(entry->item); entry->item = log; bluesky_cloudlog_ref(entry->item); g_mutex_unlock(fs->lock); diff --git a/bluesky/imap.c b/bluesky/imap.c index ec27d43..9b5f8e3 100644 --- a/bluesky/imap.c +++ b/bluesky/imap.c @@ -250,6 +250,7 @@ static void bluesky_inode_map_deserialize(BlueSkyFS *fs, BlueSkyCloudLog *imap) InodeMapEntry *entry; entry = bluesky_inode_map_lookup(fs->inode_map, *inum, 1); entry->inum = GUINT64_FROM_LE(*inum); + bluesky_cloudlog_unref_delayed(entry->item); entry->item = g_array_index(section->links, BlueSkyCloudLog *, j); bluesky_cloudlog_ref(entry->item);