#include <string.h>
#include "list.h"
#include "rendimento.h"
+#include "pagamento.h"
+#include "pmhash.h"
struct declaracao * declaracao_new(int ano)
{
dec->rendimento = list_new();
if (!dec->rendimento)
goto out_rendimento;
+ dec->pagamentos = list_new();
+ if (!dec->pagamentos)
+ goto out_pagamentos;
dec->totais = pmhash_new();
if (!dec->totais)
goto out_totais;
dec->tipo = SIMPLES;
return dec;
out_totais:
+ list_free(dec->pagamentos, pagamento_free);
+out_pagamentos:
list_free(dec->rendimento, rendimento_free);
out_rendimento:
free(dec);
free(dec->nome);
if (dec->recibo)
free(dec->recibo);
- if (dec->retifica);
+ if (dec->retifica)
free(dec->retifica);
if (dec->banco)
free(dec->banco);
if (dec->dvconta)
free(dec->dvconta);
list_free(dec->rendimento, rendimento_free);
+ list_free(dec->pagamentos, pagamento_free);
pmhash_del(dec->totais);
free(dec);
}