diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-12-15 19:49:16 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-12-15 19:49:16 +0000 |
commit | e6118ac1b13cc49f637861fccbc32a10c4ea1ea7 (patch) | |
tree | 4ccb1fb5adf96d7794872502ee975825f250054a /fitz/res_store.c | |
parent | 3031a2480fe775df825de6674495d01ae2607d93 (diff) | |
download | mupdf-e6118ac1b13cc49f637861fccbc32a10c4ea1ea7.tar.xz |
Various Memsqueezing fixes.
Fixes for leaks (and SEGVs, division by zeros etc) seen when
Memsqueezing.
Diffstat (limited to 'fitz/res_store.c')
-rw-r--r-- | fitz/res_store.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fitz/res_store.c b/fitz/res_store.c index 0b303982..a76a9bb1 100644 --- a/fitz/res_store.c +++ b/fitz/res_store.c @@ -39,7 +39,15 @@ fz_new_store_context(fz_context *ctx, unsigned int max) { fz_store *store; store = fz_malloc(ctx, sizeof(fz_store)); - store->hash = fz_new_hash_table(ctx, 4096, sizeof(struct refkey)); + fz_try(ctx) + { + store->hash = fz_new_hash_table(ctx, 4096, sizeof(struct refkey)); + } + fz_catch(ctx) + { + fz_free(ctx, store); + fz_rethrow(ctx); + } store->head = NULL; store->tail = NULL; store->size = 0; |