Commit c4dfb3f2 authored by Michael Smith's avatar Michael Smith

Don't leak file pointers (and hence file descriptors) if we can't parse a range

request.

svn path=/icecast/trunk/icecast/; revision=10977
parent 9acddcdb
...@@ -526,21 +526,11 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -526,21 +526,11 @@ int fserve_client_create (client_t *httpclient, const char *path)
fserve_content_type(path)); fserve_content_type(path));
} }
else { else {
httpclient->respcode = 416; goto fail;
sock_write (httpclient->con->sock,
"HTTP/1.0 416 Request Range Not Satisfiable\r\n\r\n");
client_destroy (httpclient);
return -1;
} }
} }
else { else {
/* If we run into any issues with the ranges goto fail;
we fallback to a normal/non-range request */
httpclient->respcode = 416;
sock_write (httpclient->con->sock,
"HTTP/1.0 416 Request Range Not Satisfiable\r\n\r\n");
client_destroy (httpclient);
return -1;
} }
} }
else { else {
...@@ -560,6 +550,14 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -560,6 +550,14 @@ int fserve_client_create (client_t *httpclient, const char *path)
fserve_add_client (httpclient, file); fserve_add_client (httpclient, file);
return 0; return 0;
fail:
fclose (file);
httpclient->respcode = 416;
sock_write (httpclient->con->sock,
"HTTP/1.0 416 Request Range Not Satisfiable\r\n\r\n");
client_destroy (httpclient);
return -1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment