diff options
Diffstat (limited to 'plugins/mate')
-rw-r--r-- | plugins/mate/mate_parser.l | 17 | ||||
-rw-r--r-- | plugins/mate/mate_runtime.c | 3 | ||||
-rw-r--r-- | plugins/mate/mate_util.c | 1 |
3 files changed, 13 insertions, 8 deletions
diff --git a/plugins/mate/mate_parser.l b/plugins/mate/mate_parser.l index 578a6b4696..45f50c8c63 100644 --- a/plugins/mate/mate_parser.l +++ b/plugins/mate/mate_parser.l @@ -86,6 +86,11 @@ #define YY_NO_UNISTD_H #endif +static void free_config_frame(mate_config_frame *frame) { + g_free(frame->filename); + g_free(frame); +} + %} pdu_kw Pdu @@ -211,8 +216,7 @@ blk_cmnt_stop "*/" yy_delete_buffer( YY_CURRENT_BUFFER ); yy_switch_to_buffer( include_stack[include_stack_ptr] ); - g_free(current_frame->filename); - g_free(current_frame); + free_config_frame(current_frame); current_frame = (mate_config_frame *)g_ptr_array_remove_index(mc->config_stack,mc->config_stack->len-1); } } @@ -318,16 +322,12 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) { yylex(); + /* Inform parser that end of input has reached. */ MateParser(pParser, 0, NULL,mc); yyrestart(NULL); MateParserFree(pParser, g_free ); - - g_free(current_frame->filename); - g_free(current_frame); - - g_ptr_array_free(mc->config_stack,FALSE); } CATCH(MateConfigError) { state = FALSE; } CATCH_ALL { @@ -336,6 +336,9 @@ extern gboolean mate_load_config(const gchar* filename, mate_config* matecfg) { } ENDTRY; + g_ptr_array_foreach(mc->config_stack, (GFunc)free_config_frame, NULL); + g_ptr_array_free(mc->config_stack, FALSE); + return state; } diff --git a/plugins/mate/mate_runtime.c b/plugins/mate/mate_runtime.c index eede6ede67..2fbd0db5aa 100644 --- a/plugins/mate/mate_runtime.c +++ b/plugins/mate/mate_runtime.c @@ -131,7 +131,7 @@ static void destroy_gogs_in_cfg(gpointer k _U_, gpointer v, gpointer p _U_) { c->last_id = 0; } -extern void initialize_mate_runtime(void) { +void initialize_mate_runtime(void) { dbg_print (dbg,5,dbg_facility,"initialize_mate: entering"); @@ -826,6 +826,7 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, apply_transforms(pdu->cfg->transforms,pdu->avpl); + g_ptr_array_foreach(data.ranges, (GFunc)g_free, NULL); g_ptr_array_free(data.ranges,TRUE); return pdu; diff --git a/plugins/mate/mate_util.c b/plugins/mate/mate_util.c index 8378d9b456..bf3f62307d 100644 --- a/plugins/mate/mate_util.c +++ b/plugins/mate/mate_util.c @@ -317,6 +317,7 @@ extern AVP* new_avp_from_finfo(const gchar* name, field_info* finfo) { if (repr) { value = scs_subscribe(avp_strings, repr); + g_free(repr); #ifdef _AVP_DEBUGGING dbg_print (dbg_avp,2,dbg_fp,"new_avp_from_finfo: from string: %s",value); #endif |