Fixed some allocation problems.

yamux
Jose Marcial Vieira Bisneto 2017-09-25 15:55:14 -03:00
parent abb607c905
commit 8b8a2844bd
No known key found for this signature in database
GPG Key ID: 103E935E7E6E831E
1 changed files with 4 additions and 3 deletions

View File

@ -366,16 +366,17 @@ struct HttpRequest* api_build_http_request(struct s_request* req) {
*value++ = '\0'; *value++ = '\0';
} }
if (value && (strcmp(name, "arg")==0)) { if (value && (strcmp(name, "arg")==0)) {
libp2p_utils_vector_add(request->arguments, value); libp2p_utils_vector_add(request->arguments, strdup(value));
} else { } else {
struct HttpParam *hp = ipfs_core_http_param_new(); struct HttpParam *hp = ipfs_core_http_param_new();
if (hp) { if (hp) {
hp->name = name; hp->name = strdup(name);
hp->value = value; // maybe null ? hp->value = strdup(value); // maybe null ?
libp2p_utils_vector_add(request->params, hp); libp2p_utils_vector_add(request->params, hp);
} }
} }
} }
free(segs);
} }
} }
} }