summaryrefslogtreecommitdiff
path: root/ext4_utils
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-06-17 17:27:20 -0700
committerColin Cross <ccross@android.com>2010-06-17 17:35:50 -0700
commita1a175aef60677ed877bcb52db553705a8e8c20f (patch)
treeb1b581036aa9a8764862f10f7c0f42117551a5ad /ext4_utils
parentec0a2e83dc66d67addeb90e83144187691852a3e (diff)
downloadextras-a1a175aef60677ed877bcb52db553705a8e8c20f.tar.gz
Fix zero-length files
Change-Id: I35812aa7a992d30ec84da57ddb1dccba7b1adf60
Diffstat (limited to 'ext4_utils')
-rw-r--r--ext4_utils/allocate.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext4_utils/allocate.c b/ext4_utils/allocate.c
index 7930573f..a95aa262 100644
--- a/ext4_utils/allocate.c
+++ b/ext4_utils/allocate.c
@@ -236,11 +236,17 @@ void reduce_allocation(struct block_allocation *alloc, u32 len)
last_reg->len -= len;
len = 0;
} else {
- struct region *reg = alloc->list.last->prev;
+ struct region *reg = alloc->list.last->prev;
free_blocks(&aux_info.bgs[last_reg->bg], last_reg->len);
len -= last_reg->len;
- if (reg)
+ if (reg) {
reg->next = NULL;
+ } else {
+ alloc->list.first = NULL;
+ alloc->list.last = NULL;
+ alloc->list.iter = NULL;
+ alloc->list.partial_iter = 0;
+ }
free(last_reg);
}
}