summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_keycache.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 5b8ec96b4d1..d5b0a0a056a 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -548,13 +548,14 @@ int flush_key_blocks(File file, enum flush_type type)
count++;
}
/* Only allocate a new buffer if its bigger than the one we have */
- if (count <= FLUSH_CACHE ||
- !(cache=(SEC_LINK**) my_malloc(sizeof(SEC_LINK*)*count,MYF(0))))
+ if (count > FLUSH_CACHE)
{
- cache=cache_buff; /* Fall back to safe buffer */
- count=FLUSH_CACHE;
+ if (!(cache=(SEC_LINK**) my_malloc(sizeof(SEC_LINK*)*count,MYF(0))))
+ {
+ cache=cache_buff; /* Fall back to safe buffer */
+ count=FLUSH_CACHE;
+ }
}
- end=cache+count;
}
/* Go through the keys and write them to buffer to be flushed */