Browse Source

Fixed minor memory leak.

grunfink 2 tuần trước cách đây
mục cha
commit
9018bac6a2
1 tập tin đã thay đổi với 4 bổ sung và 2 xóa
  1. 4 2
      httpd.c

+ 4 - 2
httpd.c

@@ -626,8 +626,10 @@ void httpd_connection(FILE *f)
     if (status == HTTP_STATUS_SEE_OTHER)
         headers = xs_dict_append(headers, "location", body);
 
-    if (status == HTTP_STATUS_FOUND)
-        headers = xs_dict_append(headers, "location", xs_fmt("%s%s", p, q_path));
+    if (status == HTTP_STATUS_FOUND) {
+        xs *s = xs_fmt("%s%s", p, q_path);
+        headers = xs_dict_append(headers, "location", s);
+    }
 
     if (status == HTTP_STATUS_UNAUTHORIZED && body) {
         xs *www_auth = xs_fmt("Basic realm=\"@%s@%s snac login\"",