aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-05-25 13:07:53 +0000
committerRafael J. Wysocki <rjw@sisk.pl>2008-05-25 13:07:53 +0000
commit024918c239095d1768553055abb2ee2de12dc8fc (patch)
tree86fa1c834185fa34a68db85d6fabbd4d81c7e165
parente19c7341563cc31a9a3b28255d32e03c5b7fc5a1 (diff)
downloadsuspend-utils-024918c239095d1768553055abb2ee2de12dc8fc.tar.gz
Fix a bug in the new memory allocator that may trigger on an attempt to
pass a wrong address to freemem() and cause it to enter an endless loop.
-rw-r--r--memalloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/memalloc.c b/memalloc.c
index 5caf2a0..0cf9628 100644
--- a/memalloc.c
+++ b/memalloc.c
@@ -167,8 +167,9 @@ void freemem(void *address)
} else if (address > slots[k].addr) {
if (i != k) {
i = k;
- } else if (slots[j].addr == address) {
- free_slot(j);
+ } else {
+ if (slots[j].addr == address)
+ free_slot(j);
break;
}
} else {