@@ -2190,6 +2190,15 @@ static int contains_operator(char *str)
2190
2190
return field_op ;
2191
2191
}
2192
2192
2193
+ static void __destroy_hist_field (struct hist_field * hist_field )
2194
+ {
2195
+ kfree (hist_field -> var .name );
2196
+ kfree (hist_field -> name );
2197
+ kfree (hist_field -> type );
2198
+
2199
+ kfree (hist_field );
2200
+ }
2201
+
2193
2202
static void destroy_hist_field (struct hist_field * hist_field ,
2194
2203
unsigned int level )
2195
2204
{
@@ -2201,14 +2210,13 @@ static void destroy_hist_field(struct hist_field *hist_field,
2201
2210
if (!hist_field )
2202
2211
return ;
2203
2212
2213
+ if (hist_field -> flags & HIST_FIELD_FL_VAR_REF )
2214
+ return ; /* var refs will be destroyed separately */
2215
+
2204
2216
for (i = 0 ; i < HIST_FIELD_OPERANDS_MAX ; i ++ )
2205
2217
destroy_hist_field (hist_field -> operands [i ], level + 1 );
2206
2218
2207
- kfree (hist_field -> var .name );
2208
- kfree (hist_field -> name );
2209
- kfree (hist_field -> type );
2210
-
2211
- kfree (hist_field );
2219
+ __destroy_hist_field (hist_field );
2212
2220
}
2213
2221
2214
2222
static struct hist_field * create_hist_field (struct hist_trigger_data * hist_data ,
@@ -2335,6 +2343,12 @@ static void destroy_hist_fields(struct hist_trigger_data *hist_data)
2335
2343
hist_data -> fields [i ] = NULL ;
2336
2344
}
2337
2345
}
2346
+
2347
+ for (i = 0 ; i < hist_data -> n_var_refs ; i ++ ) {
2348
+ WARN_ON (!(hist_data -> var_refs [i ]-> flags & HIST_FIELD_FL_VAR_REF ));
2349
+ __destroy_hist_field (hist_data -> var_refs [i ]);
2350
+ hist_data -> var_refs [i ] = NULL ;
2351
+ }
2338
2352
}
2339
2353
2340
2354
static int init_var_ref (struct hist_field * ref_field ,
0 commit comments