r19679@catbus: nickm | 2008-05-11 20:56:12 -0400

Windows does not have alloca().


svn:r810
This commit is contained in:
Nick Mathewson 2008-05-12 00:56:19 +00:00
parent 04366d5acc
commit 054159f59c

8
http.c
View File

@ -1901,8 +1901,7 @@ evhttp_dispatch_callback(struct httpcbq *callbacks, struct evhttp_request *req)
++p;
offset = (size_t)(p - req->uri);
/* allocate the rewritten version on the stack */
if ((translated = alloca(offset + 1)) == NULL)
if ((translated = mm_malloc(offset + 1)) == NULL)
return (NULL);
offset = evhttp_decode_uri_internal(req->uri, offset, translated);
@ -1911,10 +1910,13 @@ evhttp_dispatch_callback(struct httpcbq *callbacks, struct evhttp_request *req)
res = ((strncmp(cb->what, translated, offset) == 0) &&
(cb->what[offset] == '\0'));
if (res)
if (res) {
mm_free(translated);
return (cb);
}
}
mm_free(translated);
return (NULL);
}