X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fdeclaracao.c;h=7eef34c57506c26b1a1ec652a6ae9becf61607ca;hb=89da818e9788bdbc94395a3fc68a16cf16fb5f2b;hp=9d3693780c8fc4617ca8bd228c3b32718af2f681;hpb=fae07989c1dc84e67ba6517b1fff984b0fe911b2;p=cascardo%2Fdeclara.git diff --git a/lib/declaracao.c b/lib/declaracao.c index 9d36937..7eef34c 100644 --- a/lib/declaracao.c +++ b/lib/declaracao.c @@ -20,10 +20,13 @@ #include #include #include "list.h" +#include "conjuge.h" +#include "sistema.h" #include "rendimento.h" #include "isento.h" #include "pagamento.h" #include "bem.h" +#include "dependente.h" #include "pmhash.h" struct declaracao * declaracao_new(int ano) @@ -46,6 +49,9 @@ struct declaracao * declaracao_new(int ano) dec->bens = list_new(); if (!dec->bens) goto out_bens; + dec->dependentes = list_new(); + if (!dec->dependentes) + goto out_dependentes; dec->totais = pmhash_new(); if (!dec->totais) goto out_totais; @@ -55,6 +61,8 @@ struct declaracao * declaracao_new(int ano) dec->tipo = SIMPLES; return dec; out_totais: + list_free(dec->dependentes, dependente_free); +out_dependentes: list_free(dec->bens, bem_free); out_bens: list_free(dec->pagamentos, pagamento_free); @@ -89,6 +97,9 @@ void declaracao_free(struct declaracao *dec) list_free(dec->isentos, isento_free); list_free(dec->pagamentos, pagamento_free); list_free(dec->bens, bem_free); + list_free(dec->dependentes, dependente_free); pmhash_del(dec->totais); + conjuge_free(dec); + sistema_free(dec); free(dec); }