diff options
Diffstat (limited to 'src/frame.c')
-rw-r--r-- | src/frame.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/frame.c b/src/frame.c index 40daa86..2906c40 100644 --- a/src/frame.c +++ b/src/frame.c @@ -31,6 +31,7 @@ #include "sc_parse.h" #include "frame.h" +#include "wrap.h" static int alloc_ro(struct frame *fr) @@ -56,12 +57,23 @@ struct frame *frame_new() n->children = NULL; n->max_children = 32; - alloc_ro(n); - + if ( alloc_ro(n) ) { + fprintf(stderr, "Couldn't allocate children\n"); + free(n); + return NULL; + } n->num_children = 0; n->scblocks = NULL; + n->boxes = malloc(sizeof(struct wrap_line)); + if ( n->boxes == NULL ) { + fprintf(stderr, "Failed to allocate boxes.\n"); + free(n); + return NULL; + } + initialise_line(n->boxes); + return n; } |