--- psiconv/trunk/lib/psiconv/data.c 2001/01/29 21:57:05 98 +++ psiconv/trunk/lib/psiconv/data.c 2001/01/30 21:37:19 99 @@ -34,6 +34,7 @@ static void psiconv_free_paragraph_aux(void * paragraph); static void psiconv_free_paint_data_section_aux(void * section); static void psiconv_free_clipart_section_aux(void * section); +static void psiconv_free_formula_aux(void *data); static psiconv_word_styles_section psiconv_empty_word_styles_section(void); static psiconv_text_and_layout psiconv_empty_text_and_layout(void); @@ -547,17 +548,37 @@ free(section); } -/* TODO: Free sublists, strings etc. depending on formula->type */ +void psiconv_free_formula_aux(void *data) +{ + psiconv_formula formula; + formula = data; + if (formula->type == psiconv_formula_dat_string) + free(formula->data.dat_string); + else if ((formula->type != psiconv_formula_dat_int) && + (formula->type != psiconv_formula_dat_var) && + (formula->type != psiconv_formula_dat_float) && + (formula->type != psiconv_formula_dat_cellref) && + (formula->type != psiconv_formula_dat_cellblock) && + (formula->type != psiconv_formula_dat_vcellblock) && + (formula->type != psiconv_formula_mark_opsep) && + (formula->type != psiconv_formula_mark_opend) && + (formula->type != psiconv_formula_mark_eof) && + (formula->type != psiconv_formula_unknown)) + psiconv_free_formula_list(formula->data.fun_operands); +} + void psiconv_free_formula(psiconv_formula formula) { - if (formula) + if (formula) { + psiconv_free_formula_aux(formula); free(formula); + } } void psiconv_free_formula_list(psiconv_formula_list list) { - if (list) - psiconv_list_free(list); + if (list) + psiconv_list_free_el(list,psiconv_free_formula_aux); } void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)