diff --git a/deps/aha/aha.c b/deps/aha/aha.c index 5696a30..065eb20 100644 --- a/deps/aha/aha.c +++ b/deps/aha/aha.c @@ -84,13 +84,13 @@ void deleteParse(pelem elem) } } -void append_output(char *output, char *stuff, int *size, int *at) { +void append_output(char **output, char *stuff, int *size, int *at) { if (*at + strlen(stuff) + 1 >= *size) { *size += 256; - output = realloc(output, *size); + *output = realloc(*output, *size); } - strcat(output, stuff); + strcat(*output, stuff); *at += strlen(stuff); } @@ -227,92 +227,92 @@ char * aha(char *input) if ((fc!=ofc) || (bc!=obc) || (ul!=oul) || (bo!=obo) || (bl!=obl)) //ANY Change { if ((ofc!=-1) || (obc!=-1) || (oul!=0) || (obo!=0) || (obl!=0)) - append_output(output, "", &size, &outat); + append_output(&output, "", &size, &outat); if ((fc!=-1) || (bc!=-1) || (ul!=0) || (bo!=0) || (bl!=0)) { - append_output(output, "", &size, &outat); + append_output(&output, "\">", &size, &outat); } } } @@ -322,10 +322,10 @@ char * aha(char *input) { for (;line<80;line++) - append_output(output, " ", &size, &outat); + append_output(&output, " ", &size, &outat); line=0; momline++; - append_output(output, "\n", &size, &outat); + append_output(&output, "\n", &size, &outat); } else if (c!=8) { @@ -334,22 +334,22 @@ char * aha(char *input) { while (newline>line) { - append_output(output, " ", &size, &outat); + append_output(&output, " ", &size, &outat); line++; } newline=-1; } switch (c) { - case '&': append_output(output, "&", &size, &outat); break; - case '\"': append_output(output, """, &size, &outat); break; - case '<': append_output(output, "<", &size, &outat); break; - case '>': append_output(output, ">", &size, &outat); break; + case '&': append_output(&output, "&", &size, &outat); break; + case '\"': append_output(&output, """, &size, &outat); break; + case '<': append_output(&output, "<", &size, &outat); break; + case '>': append_output(&output, ">", &size, &outat); break; case '\n':case 13: momline++; line=0; default: { sprintf(minibuf, "%c", c); - append_output(output, minibuf, &size, &outat); + append_output(&output, minibuf, &size, &outat); } } } @@ -357,7 +357,7 @@ char * aha(char *input) //Footer if ((fc!=-1) || (bc!=-1) || (ul!=0) || (bo!=0) || (bl!=0)) - append_output(output, "\n", &size, &outat); + append_output(&output, "\n", &size, &outat); return 0; } diff --git a/www_msgs.c b/www_msgs.c index 49aa348..ab6f808 100644 --- a/www_msgs.c +++ b/www_msgs.c @@ -479,6 +479,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i strcat(page, aha_out); len += strlen(aha_out); + free(aha_out); sprintf(buffer, "\n"); if (len + strlen(buffer) > max_len - 1) {