瀏覽代碼

Merge pull request #675 from mretallack/master

fixed memory leak in get_request when fetching the remote host
bel2125 6 年之前
父節點
當前提交
7c91f79161
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/civetweb.c

+ 3 - 0
src/civetweb.c

@@ -16947,6 +16947,9 @@ get_request(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int *err)
 	/* Message is a valid request */
 
 	/* Is there a "host" ? */
+	if (conn->host!=NULL) {
+		mg_free((void *)conn->host);
+	}
 	conn->host = alloc_get_host(conn);
 	if (!conn->host) {
 		mg_snprintf(conn,