properly initialize slot_alloc for new contexts
authorTony Cook <tony@develop-help.com>
Mon, 29 Oct 2012 10:01:49 +0000 (21:01 +1100)
committerTony Cook <tony@develop-help.com>
Fri, 14 Dec 2012 09:27:39 +0000 (20:27 +1100)
context.c

index 75fcd944c9b39d550c236f149bf98aba6f9b8d8e..450804d6164594292d7085af311f84dc9f45746e 100644 (file)
--- a/context.c
+++ b/context.c
@@ -38,7 +38,8 @@ im_context_new(void) {
   ctx->max_height = 0;
   ctx->max_bytes = DEF_BYTES_LIMIT;
 
-  ctx->slots = calloc(sizeof(void *), slot_count);
+  ctx->slot_alloc = slot_count;
+  ctx->slots = calloc(sizeof(void *), ctx->slot_alloc);
   if (!ctx->slots) {
     free(ctx);
     return NULL;