url.c and file.c: fix OOM triggered segfault
This commit is contained in:
parent
93e57d0628
commit
6fa6567b92
@ -184,7 +184,7 @@ static CURLcode file_range(struct connectdata *conn)
|
|||||||
static CURLcode file_connect(struct connectdata *conn, bool *done)
|
static CURLcode file_connect(struct connectdata *conn, bool *done)
|
||||||
{
|
{
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
char *real_path = curl_easy_unescape(data, data->state.path, 0, NULL);
|
char *real_path;
|
||||||
struct FILEPROTO *file;
|
struct FILEPROTO *file;
|
||||||
int fd;
|
int fd;
|
||||||
#ifdef DOS_FILESYSTEM
|
#ifdef DOS_FILESYSTEM
|
||||||
@ -192,13 +192,14 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
|
|||||||
char *actual_path;
|
char *actual_path;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!real_path)
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
/* If there already is a protocol-specific struct allocated for this
|
/* If there already is a protocol-specific struct allocated for this
|
||||||
sessionhandle, deal with it */
|
sessionhandle, deal with it */
|
||||||
Curl_reset_reqproto(conn);
|
Curl_reset_reqproto(conn);
|
||||||
|
|
||||||
|
real_path = curl_easy_unescape(data, data->state.path, 0, NULL);
|
||||||
|
if(!real_path)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
if(!data->state.proto.file) {
|
if(!data->state.proto.file) {
|
||||||
file = calloc(1, sizeof(struct FILEPROTO));
|
file = calloc(1, sizeof(struct FILEPROTO));
|
||||||
if(!file) {
|
if(!file) {
|
||||||
|
@ -2606,7 +2606,7 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
|
|||||||
data = conn->data;
|
data = conn->data;
|
||||||
|
|
||||||
if(!data) {
|
if(!data) {
|
||||||
DEBUGF(infof(data, "DISCONNECT without easy handle, ignoring\n"));
|
DEBUGF(fprintf(stderr, "DISCONNECT without easy handle, ignoring\n"));
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user