[augeas-devel] [PATCH] * src/pathx.c (eval_filter): correctly hande realloc of value_pool

David Lutterkort lutter at redhat.com
Tue Mar 24 01:47:04 UTC 2009


---
 src/pathx.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/pathx.c b/src/pathx.c
index 8e522a9..74324ce 100644
--- a/src/pathx.c
+++ b/src/pathx.c
@@ -891,9 +891,12 @@ static void eval_filter(struct expr *expr, struct state *state) {
     } else {
         eval_expr(expr->primary, state);
         CHECK_ERROR;
-        struct value *primary = pop_value(state);
+        value_ind_t primary_ind = pop_value_ind(state);
+        struct value *primary = state->value_pool + primary_ind;
         assert(primary->tag == T_NODESET);
         ns_filter(primary->nodeset, expr->predicates, state);
+        /* Evaluating predicates might have reallocated the value_pool */
+        primary = state->value_pool + primary_ind;
         ns_from_locpath(lp, &maxns, &ns, primary->nodeset, state);
     }
     CHECK_ERROR;
-- 
1.6.0.6




More information about the augeas-devel mailing list