aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-11-03 21:56:51 +0100
committerYang Tse <yangsita@gmail.com>2011-11-03 21:56:51 +0100
commit6fa6567b92621de2d5f5958fa6f29b00384b9174 (patch)
tree7afc3fa6f54dcea08579031631aa388bde9f594d
parent93e57d0628aad62330dc62ff809752a0478824c4 (diff)
url.c and file.c: fix OOM triggered segfault
-rw-r--r--lib/file.c9
-rw-r--r--lib/url.c2
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/file.c b/lib/file.c
index 00d5fc09b..9421c445b 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -184,7 +184,7 @@ static CURLcode file_range(struct connectdata *conn)
static CURLcode file_connect(struct connectdata *conn, bool *done)
{
struct SessionHandle *data = conn->data;
- char *real_path = curl_easy_unescape(data, data->state.path, 0, NULL);
+ char *real_path;
struct FILEPROTO *file;
int fd;
#ifdef DOS_FILESYSTEM
@@ -192,13 +192,14 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
char *actual_path;
#endif
- if(!real_path)
- return CURLE_OUT_OF_MEMORY;
-
/* If there already is a protocol-specific struct allocated for this
sessionhandle, deal with it */
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) {
file = calloc(1, sizeof(struct FILEPROTO));
if(!file) {
diff --git a/lib/url.c b/lib/url.c
index 9c7966fc0..4bc82a65f 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2606,7 +2606,7 @@ CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
data = conn->data;
if(!data) {
- DEBUGF(infof(data, "DISCONNECT without easy handle, ignoring\n"));
+ DEBUGF(fprintf(stderr, "DISCONNECT without easy handle, ignoring\n"));
return CURLE_OK;
}