@@ -762,7 +762,7 @@ void printhtml(FILE *fp, char *line)
762
762
void printdates (FILE * fp , struct header * hp , int year , int month , struct emailinfo * subdir_email ,
763
763
char * prev_date_str )
764
764
{
765
- char * subj ;
765
+ char * subj , * tmpptr = 0 ;
766
766
const char * startline ;
767
767
const char * break_str ;
768
768
const char * endline ;
@@ -812,9 +812,11 @@ void printdates(FILE *fp, struct header *hp, int year, int month, struct emailin
812
812
}
813
813
fprintf (fp ,"%s<a href=\"%s\">%s%s%s</a>%s<a name=\"%d\"><em>%s</em></a>%s%s%s\n" ,
814
814
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 ),
816
816
break_str , date_str , endline );
817
817
free (subj );
818
+ if (tmpptr )
819
+ free (tmpptr );
818
820
}
819
821
printdates (fp , hp -> right , year , month , subdir_email , prev_date_str );
820
822
}
@@ -826,7 +828,7 @@ void printdates(FILE *fp, struct header *hp, int year, int month, struct emailin
826
828
*/
827
829
int printattachments (FILE * fp , struct header * hp , struct emailinfo * subdir_email , bool * is_first )
828
830
{
829
- char * subj ;
831
+ char * subj , * tmpptr = 0 ;
830
832
char * attdir ;
831
833
char * msgnum ;
832
834
int nb_attach = 0 ;
@@ -850,13 +852,13 @@ int printattachments(FILE *fp, struct header *hp, struct emailinfo *subdir_email
850
852
/* consider that if there's an attachment directory, there are attachments */
851
853
nb_attach ++ ;
852
854
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 ));
854
856
}
855
857
else {
856
858
fprintf (fp , "<li>%s%s<dfn>%s</dfn></a> "
857
859
"<a name=\"%d\"><em>%s</em></a> <em>(%s)</em>\n" ,
858
860
(* 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 ),
860
862
getindexdatestr (em -> date ));
861
863
if (* is_first )
862
864
* is_first = FALSE;
@@ -901,6 +903,8 @@ int printattachments(FILE *fp, struct header *hp, struct emailinfo *subdir_email
901
903
}
902
904
free (attdir );
903
905
free (subj );
906
+ if (tmpptr )
907
+ free (tmpptr );
904
908
}
905
909
nb_attach += printattachments (fp , hp -> right , subdir_email , is_first );
906
910
}
@@ -2566,7 +2570,7 @@ void writethreads(int amountmsgs, struct emailinfo *email)
2566
2570
void printsubjects (FILE * fp , struct header * hp , char * * oldsubject ,
2567
2571
int year , int month , struct emailinfo * subdir_email )
2568
2572
{
2569
- char * subj ;
2573
+ char * subj , * tmpptr = 0 ;
2570
2574
const char * startline ;
2571
2575
const char * break_str ;
2572
2576
const char * endline ;
@@ -2615,11 +2619,13 @@ void printsubjects(FILE *fp, struct header *hp, char **oldsubject,
2615
2619
}
2616
2620
fprintf (fp ,
2617
2621
"%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 ,
2619
2623
hp -> data -> msgnum , date_str , endline );
2620
2624
* oldsubject = hp -> data -> unre_subject ;
2621
2625
2622
2626
free (subj );
2627
+ if (tmpptr )
2628
+ free (tmpptr );
2623
2629
}
2624
2630
printsubjects (fp , hp -> right , oldsubject , year , month , subdir_email );
2625
2631
}
0 commit comments