diff --git a/src/encode.c b/src/encode.c index dc62d23245aa6133a4a25c71e268b5493d6d47d4..fd124983a043ea190a8269537b672037cdf9855b 100644 --- a/src/encode.c +++ b/src/encode.c @@ -2597,6 +2597,12 @@ static void decode_value2(struct decode_data *data) if (!(delayed_enc_val = low_mapping_lookup (data->decoded, &entry_id))) decode_error (data, NULL, "Failed to find previous record of " "delay encoded entry <%d>.\n", num); + if (TYPEOF(*delayed_enc_val) != T_PROGRAM || + delayed_enc_val->u.program->flags != PROGRAM_VIRGIN) { + decode_error (data, NULL, "Didn't get program embryo " + "for delay encoded program <%O>: %O\n", + &entry_id, delayed_enc_val); + } DECODE ("decode_value2"); break; @@ -2786,7 +2792,7 @@ static void decode_value2(struct decode_data *data) SETUP_DECODE_MEMOBJ (T_MULTISET, multiset, m, allocate_multiset (0, 0, NULL), ;); /* FIXME: This array could be avoided by building the multiset directly. */ - a = low_allocate_array (num, 0); + push_array(a = low_allocate_array (num, 0)); types = 0; for(e=0;e<num;e++) @@ -2798,7 +2804,7 @@ static void decode_value2(struct decode_data *data) a->type_field = types; { struct multiset *l = mkmultiset (a); - free_array (a); + pop_stack(); /* This special case is handled efficiently by merge_multisets. */ merge_multisets (m, l, PIKE_MERGE_DESTR_A | PIKE_ARRAY_OP_ADD); free_multiset (l); @@ -3204,12 +3210,6 @@ static void decode_value2(struct decode_data *data) data->depth, ""); print_svalue(stderr, delayed_enc_val); fputc('\n', stderr);); - if (TYPEOF(*delayed_enc_val) != T_PROGRAM || - delayed_enc_val->u.program->flags != PROGRAM_VIRGIN) { - decode_error (data, NULL, "Didn't get program embryo " - "for delay encoded program <%O>: %O\n", - &entry_id, delayed_enc_val); - } /* No new ref here; low_start_new_program will add one for * Pike_compiler->new_program and we want ride on that one * just like when it's created there. */