@@ -958,7 +958,7 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, map_list_t *out, map_t *parent, CONF_S
958958 * them for now. Once the functionality
959959 * is tested and used, we can allow that.
960960 */
961- slen = tmpl_afrom_attr_str (ctx , NULL , & map -> lhs , cf_section_name1 (subcs ), & our_lhs_rules );
961+ slen = tmpl_afrom_attr_str (map , NULL , & map -> lhs , cf_section_name1 (subcs ), & our_lhs_rules );
962962 if (slen <= 0 ) {
963963 cf_log_err (ci , "Failed parsing attribute reference for list %s - %s" ,
964964 cf_section_name1 (subcs ), fr_strerror ());
@@ -1479,7 +1479,10 @@ int map_afrom_vp(TALLOC_CTX *ctx, map_t **out, fr_pair_t *vp, tmpl_rules_t const
14791479 * Allocate the LHS
14801480 */
14811481 map -> lhs = tmpl_alloc (map , TMPL_TYPE_ATTR , T_BARE_WORD , NULL , 0 );
1482- if (!map -> lhs ) goto oom ;
1482+ if (!map -> lhs ) {
1483+ talloc_free (map );
1484+ goto oom ;
1485+ }
14831486
14841487 tmpl_attr_set_leaf_da (map -> lhs , vp -> da );
14851488
@@ -1493,7 +1496,10 @@ int map_afrom_vp(TALLOC_CTX *ctx, map_t **out, fr_pair_t *vp, tmpl_rules_t const
14931496 * Allocate the RHS
14941497 */
14951498 map -> rhs = tmpl_alloc (map , TMPL_TYPE_DATA , T_BARE_WORD , NULL , -1 );
1496- if (!map -> rhs ) goto oom ;
1499+ if (!map -> rhs ) {
1500+ talloc_free (map );
1501+ goto oom ;
1502+ }
14971503
14981504 switch (vp -> vp_type ) {
14991505 case FR_TYPE_QUOTED :
@@ -2409,10 +2415,11 @@ ssize_t map_print(fr_sbuff_t *out, map_t const *map)
24092415 }
24102416
24112417 /*
2412- * If there's no child and no RHS then the
2413- * map was invalid.
2418+ * If there's no RHS but no children, then the map was
2419+ * invalid.
24142420 */
2415- if (map_list_empty (& map -> child ) && !fr_cond_assert (map -> rhs != NULL )) {
2421+ if (!map -> rhs ) {
2422+ fr_assert (!map_list_empty (& map -> child ));
24162423 fr_sbuff_terminate (out );
24172424 return 0 ;
24182425 }
@@ -2626,7 +2633,7 @@ int map_afrom_fields(TALLOC_CTX *ctx, map_t **out, map_t **parent_p, request_t *
26262633 *
26272634 * @todo - track relative attributes, which begin with a '.'
26282635 */
2629- slen = tmpl_afrom_attr_str (ctx , NULL , & map -> lhs , lhs , lhs_rules );
2636+ slen = tmpl_afrom_attr_str (map , NULL , & map -> lhs , lhs , lhs_rules );
26302637 }
26312638 if (slen <= 0 ) {
26322639 error :
0 commit comments