Fixed some allocation problems.

This commit is contained in:
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

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);
} }
} }
} }