Skip to content

Commit 0d553e0

Browse files
author
Daigo Matsubara
committed
oops, forgot to free them!
1 parent f1f2117 commit 0d553e0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/print.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ void printhtml(FILE *fp, char *line)
762762
void printdates(FILE *fp, struct header *hp, int year, int month, struct emailinfo *subdir_email,
763763
char *prev_date_str)
764764
{
765-
char *subj;
765+
char *subj,*tmpptr=0;
766766
const char *startline;
767767
const char *break_str;
768768
const char *endline;
@@ -812,9 +812,11 @@ void printdates(FILE *fp, struct header *hp, int year, int month, struct emailin
812812
}
813813
fprintf(fp,"%s<a href=\"%s\">%s%s%s</a>%s<a name=\"%d\"><em>%s</em></a>%s%s%s\n",
814814
startline, msg_href(em, subdir_email, FALSE),
815-
subj_tag, subj, subj_end_tag, break_str, em->msgnum, convchars(em->name,em->charset),
815+
subj_tag, subj, subj_end_tag, break_str, em->msgnum, tmpptr=convchars(em->name,em->charset),
816816
break_str, date_str, endline);
817817
free(subj);
818+
if(tmpptr)
819+
free(tmpptr);
818820
}
819821
printdates(fp, hp->right, year, month, subdir_email, prev_date_str);
820822
}
@@ -826,7 +828,7 @@ void printdates(FILE *fp, struct header *hp, int year, int month, struct emailin
826828
*/
827829
int printattachments(FILE *fp, struct header *hp, struct emailinfo *subdir_email, bool *is_first)
828830
{
829-
char *subj;
831+
char *subj,*tmpptr=0;
830832
char *attdir;
831833
char *msgnum;
832834
int nb_attach = 0;
@@ -850,13 +852,13 @@ int printattachments(FILE *fp, struct header *hp, struct emailinfo *subdir_email
850852
/* consider that if there's an attachment directory, there are attachments */
851853
nb_attach++;
852854
if (set_indextable) {
853-
fprintf(fp, "<tr><td>%s%s</a></td><td><a name=\"%d\"><em>%s</em></a></td>" "<td>%s</td></tr>\n", msg_href(em, subdir_email, TRUE), subj, em->msgnum, convchars(em->name,em->charset), getindexdatestr(em->date));
855+
fprintf(fp, "<tr><td>%s%s</a></td><td><a name=\"%d\"><em>%s</em></a></td>" "<td>%s</td></tr>\n", msg_href(em, subdir_email, TRUE), subj, em->msgnum, tmpptr=convchars(em->name,em->charset), getindexdatestr(em->date));
854856
}
855857
else {
856858
fprintf(fp, "<li>%s%s<dfn>%s</dfn></a>&nbsp;"
857859
"<a name=\"%d\"><em>%s</em></a>&nbsp;<em>(%s)</em>\n",
858860
(*is_first) ? first_attributes : "",
859-
msg_href(em, subdir_email, TRUE), subj, em->msgnum, convchars(em->name,em->charset),
861+
msg_href(em, subdir_email, TRUE), subj, em->msgnum, tmpptr=convchars(em->name,em->charset),
860862
getindexdatestr(em->date));
861863
if (*is_first)
862864
*is_first = FALSE;
@@ -901,6 +903,8 @@ int printattachments(FILE *fp, struct header *hp, struct emailinfo *subdir_email
901903
}
902904
free(attdir);
903905
free(subj);
906+
if(tmpptr)
907+
free(tmpptr);
904908
}
905909
nb_attach += printattachments(fp, hp->right, subdir_email, is_first);
906910
}
@@ -2566,7 +2570,7 @@ void writethreads(int amountmsgs, struct emailinfo *email)
25662570
void printsubjects(FILE *fp, struct header *hp, char **oldsubject,
25672571
int year, int month, struct emailinfo *subdir_email)
25682572
{
2569-
char *subj;
2573+
char *subj, *tmpptr=0;
25702574
const char *startline;
25712575
const char *break_str;
25722576
const char *endline;
@@ -2615,11 +2619,13 @@ void printsubjects(FILE *fp, struct header *hp, char **oldsubject,
26152619
}
26162620
fprintf(fp,
26172621
"%s%s%s</a>%s <a name=\"%d\">%s</a>%s\n", startline,
2618-
msg_href(hp->data, subdir_email, TRUE), convchars(hp->data->name,hp->data->charset), break_str,
2622+
msg_href(hp->data, subdir_email, TRUE), tmpptr=convchars(hp->data->name,hp->data->charset), break_str,
26192623
hp->data->msgnum, date_str, endline);
26202624
*oldsubject = hp->data->unre_subject;
26212625

26222626
free(subj);
2627+
if(tmpptr)
2628+
free(tmpptr);
26232629
}
26242630
printsubjects(fp, hp->right, oldsubject, year, month, subdir_email);
26252631
}

0 commit comments

Comments
 (0)