summaryrefslogtreecommitdiff
path: root/fitz/stm_open.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-20 17:27:42 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-20 17:27:42 +0000
commit5474e8ea6bcc637357911264358085704855ffad (patch)
tree1d2a57fb6e2b00aa17f5c863ffe4497652fd6328 /fitz/stm_open.c
parentdfa245914d586889b4786d9b006d3ff5dac41840 (diff)
downloadmupdf-5474e8ea6bcc637357911264358085704855ffad.tar.xz
More memsqueezing fixes.
One of the previous memsqueezing fixes (specifically that in close_dctd) appears to cause the Memento fork bases squeezing process to stop. This appears to be because old code would do a NULL dereference causing a SEGV. This would somehow NOT be picked up by the signal handler, and the child would exit. If the code is fixed to avoid the SEGV the code then somehow goes on to do something (not in the close_dctd code) that makes the mem squeeze process grind to a halt - but NOT in the same instance of the executable. I am at a loss to explain this, but would rather the code stays as it is (being as far as I can see correct) for now.
Diffstat (limited to 'fitz/stm_open.c')
-rw-r--r--fitz/stm_open.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fitz/stm_open.c b/fitz/stm_open.c
index 45689502..37230243 100644
--- a/fitz/stm_open.c
+++ b/fitz/stm_open.c
@@ -97,7 +97,15 @@ fz_open_fd(fz_context *ctx, int fd)
state = fz_malloc_struct(ctx, int);
*state = fd;
- stm = fz_new_stream(ctx, state, read_file, close_file);
+ fz_try(ctx)
+ {
+ stm = fz_new_stream(ctx, state, read_file, close_file);
+ }
+ fz_catch(ctx)
+ {
+ fz_free(ctx, state);
+ fz_rethrow(ctx);
+ }
stm->seek = seek_file;
return stm;