aboutsummaryrefslogtreecommitdiff
path: root/src/frame.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-03-09 22:16:33 +0100
committerThomas White <taw@bitwiz.org.uk>2013-03-09 22:16:33 +0100
commitea571741f1c90ceee380a02a2e4320d54a3e0b62 (patch)
treea5064940af6dc5f2765e348ef5c58cdc5ec68a77 /src/frame.c
parentb4fa75b9ac5160dae40c4763ba87927762d4e75f (diff)
Fix unpacking
Diffstat (limited to 'src/frame.c')
-rw-r--r--src/frame.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/frame.c b/src/frame.c
index ed6047a..59c05db 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -106,13 +106,14 @@ static void show_heirarchy(struct frame *fr, const char *t)
}
-static void recursive_unpack(struct frame *fr, const char *sc)
+static int recursive_unpack(struct frame *fr, const char *sc)
{
SCBlockList *bl;
SCBlockListIterator *iter;
struct scblock *b;
bl = sc_find_blocks(sc, "f");
+ if ( bl == NULL ) return 1;
for ( b = sc_block_list_first(bl, &iter);
b != NULL;
@@ -121,9 +122,14 @@ static void recursive_unpack(struct frame *fr, const char *sc)
struct frame *sfr;
sfr = add_subframe(fr);
sfr->sc = remove_blocks(b->contents, "f");
- recursive_unpack(sfr, b->contents);
+ if ( recursive_unpack(sfr, b->contents) ) {
+ sc_block_list_free(bl);
+ return 1;
+ }
}
sc_block_list_free(bl);
+
+ return 0;
}
@@ -136,7 +142,9 @@ struct frame *sc_unpack(const char *sc)
if ( fr == NULL ) return NULL;
fr->sc = remove_blocks(sc, "f");
- recursive_unpack(fr, sc);
+ if ( recursive_unpack(fr, sc) ) {
+ return NULL;
+ }
show_heirarchy(fr, "");