mirror of
https://github.com/fumiama/simple-http-server.git
synced 2026-06-05 00:30:23 +08:00
尝试修复内存泄漏
This commit is contained in:
6
server.c
6
server.c
@@ -121,10 +121,10 @@ static void accept_request(void *cli) {
|
|||||||
not_found(client);
|
not_found(client);
|
||||||
} else {
|
} else {
|
||||||
int pathlen = strlen(path) + 1;
|
int pathlen = strlen(path) + 1;
|
||||||
char path_heap[pathlen + 11]; // 11 is for possible /index.html
|
char path_stack[pathlen + 11]; // 11 is for possible /index.html
|
||||||
memcpy(path_heap, path, pathlen);
|
memcpy(path_stack, path, pathlen);
|
||||||
printf("<%d> ", pathlen);
|
printf("<%d> ", pathlen);
|
||||||
path = path_heap;
|
path = path_stack;
|
||||||
|
|
||||||
int query_length = strlen(query_string) + 1;
|
int query_length = strlen(query_string) + 1;
|
||||||
char query_string_stack[query_length];
|
char query_string_stack[query_length];
|
||||||
|
|||||||
Reference in New Issue
Block a user