]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Mark up allocated subsections with the talloc type if one is set
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Jun 2017 13:58:39 +0000 (09:58 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Jun 2017 13:58:39 +0000 (09:58 -0400)
src/include/cf_parse.h
src/main/cf_parse.c

index b3b35964b0666c6244872ab0733cf0611763859d..289cc4bfba6c1d8f11eb1942ea1e47916ca08254 100644 (file)
@@ -427,6 +427,7 @@ struct CONF_PARSER {
                                                        //!< #CONF_PARSER structs, forming the subsection.
                        size_t          subcs_size;     //!< If non-zero, allocate structs of this size to hold
                                                        //!< the parsed data.
+                       char const      *subcs_type;    //!< Set a specific talloc type for subcs structures.
                };
        };
 
index bb470851ff71085f70b0d5f22cd7727b569caa3c..b352bbe44203345033bd778212816785d62026bf 100644 (file)
@@ -896,7 +896,10 @@ static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CON
                 */
                if (!subcs_size) return cf_section_parse(ctx, out, subcs);
 
-               if (out) MEM(buff = talloc_array(ctx, uint8_t, subcs_size));
+               if (out) {
+                       MEM(buff = talloc_array(ctx, uint8_t, subcs_size));
+                       if (rule->subcs_type) talloc_set_name_const(buff, rule->subcs_type);
+               }
 
                ret = cf_section_parse(buff, buff, subcs);
                if (ret < 0) {
@@ -918,8 +921,10 @@ static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CON
        /*
         *      Allocate an array to hold the subsections
         */
-       if (out) MEM(array = talloc_array(ctx, uint8_t *, count));
-
+       if (out) {
+               MEM(array = talloc_array(ctx, uint8_t *, count));
+               if (rule->subcs_type) talloc_set_name(array, "%s *", rule->subcs_type);
+       }
        /*
         *      Start parsing...
         *
@@ -937,6 +942,7 @@ static int cf_subsection_parse(TALLOC_CTX *ctx, void *out, CONF_SECTION *cs, CON
 
                if (array) {
                        MEM(buff = talloc_zero_array(array, uint8_t, subcs_size));
+                       if (rule->subcs_type) talloc_set_name_const(buff, rule->subcs_type);
                        array[i] = buff;
                }