From: Michael Vrable Date: Sun, 22 Aug 2010 04:48:50 +0000 (-0700) Subject: Fix a longstanding(?) memory-leak bug when truncating a file. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=1b4b1366b18685f5680ab01b58b8e49d32b14e7e;p=bluesky.git Fix a longstanding(?) memory-leak bug when truncating a file. --- diff --git a/bluesky/file.c b/bluesky/file.c index 94677f6..a6f6a15 100644 --- a/bluesky/file.c +++ b/bluesky/file.c @@ -93,7 +93,7 @@ void bluesky_file_truncate(BlueSkyInode *inode, uint64_t size) g_array_set_size(inode->blocks, blocks); } else if (blocks < inode->blocks->len) { /* Delete blocks from a file. Must reclaim memory. */ - for (guint i = inode->blocks->len; i < blocks; i++) { + for (guint i = blocks; i < inode->blocks->len; i++) { BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, i); if (b->type == BLUESKY_BLOCK_DIRTY) g_atomic_int_add(&inode->fs->cache_dirty, -1);