while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
line_length = strlen(buf);
buffer_length = content_length + line_length + 2;
- msg = realloc(msg, buffer_length);
- if (msg == NULL) {
+ ptr = realloc(msg, buffer_length);
+ if (ptr == NULL) {
wprintf("<b>");
wprintf(_("realloc() error! couldn't get %d bytes: %s"),
buffer_length + 1,
strerror(errno));
wprintf("</b><br /><br />\n");
+ while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+ /** flush */
+ }
+ free(msg);
return;
}
+ msg = ptr;
strcpy(&msg[content_length], buf);
content_length += line_length;
strcpy(&msg[content_length], "\n");