memory leak in AirPlay

This commit is contained in:
philippe44
2019-08-23 00:23:00 -07:00
parent 0ee2783b49
commit 8a0763cc27
4 changed files with 30 additions and 29 deletions

View File

@@ -377,7 +377,7 @@ bool http_parse(int sock, char *method, key_data_t *rkd, char **body, int *len)
// line folding should be deprecated
if (i && rkd[i].key && (line[0] == ' ' || line[0] == '\t')) {
for(j = 0; j < strlen(line); j++) if (line[j] != ' ' && line[j] != '\t') break;
rkd[i].data = realloc(rkd[i].data, strlen(rkd[i].data) + strlen(line + j) + 1);
rkd[i].data = realloc(rkd[i].data, strlen(rkd[i].data) + strlen(line + j) + 1);
strcat(rkd[i].data, line + j);
continue;
}
@@ -403,7 +403,7 @@ bool http_parse(int sock, char *method, key_data_t *rkd, char **body, int *len)
if (*len) {
int size = 0;
*body = malloc(*len + 1);
*body = malloc(*len + 1);
while (*body && size < *len) {
int bytes = recv(sock, *body + size, *len - size, 0);
if (bytes <= 0) break;