mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
Don't leak file pointers (and hence file descriptors) if we can't parse a range
request. svn path=/icecast/trunk/icecast/; revision=10977
This commit is contained in:
parent
9acddcdb8a
commit
c4dfb3f2fd
22
src/fserve.c
22
src/fserve.c
@ -526,21 +526,11 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
fserve_content_type(path));
|
||||
}
|
||||
else {
|
||||
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;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* If we run into any issues with the ranges
|
||||
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;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -560,6 +550,14 @@ int fserve_client_create (client_t *httpclient, const char *path)
|
||||
fserve_add_client (httpclient, file);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user