1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Fixed some compiler warnings. Fixed a low incidence memory leak in the test server.

This commit is contained in:
Dan Fandrich 2005-02-24 18:54:23 +00:00
parent 5faf52619d
commit 9798432f56
2 changed files with 9 additions and 6 deletions

View File

@ -166,7 +166,7 @@ int Curl_input_negotiate(struct connectdata *conn, char *header)
len = strlen(header); len = strlen(header);
if (len > 0) { if (len > 0) {
int rawlen = Curl_base64_decode(header, &input_token.value); int rawlen = Curl_base64_decode(header, (unsigned char **)&input_token.value);
if (rawlen < 0) if (rawlen < 0)
return -1; return -1;
input_token.length = rawlen; input_token.length = rawlen;
@ -206,7 +206,7 @@ int Curl_input_negotiate(struct connectdata *conn, char *header)
input_token.length = mechTokenLength; input_token.length = mechTokenLength;
free(mechToken); free(mechToken);
mechToken = NULL; mechToken = NULL;
infof(conn->data, "Parse SPNEGO Target Token succeded\n"); infof(conn->data, "Parse SPNEGO Target Token succeeded\n");
} }
} }
#endif #endif
@ -287,7 +287,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn)
neg_ctx->output_token.length = spnegoTokenLength; neg_ctx->output_token.length = spnegoTokenLength;
free(spnegoToken); free(spnegoToken);
spnegoToken = NULL; spnegoToken = NULL;
infof(conn->data, "Make SPNEGO Initial Token succeded\n"); infof(conn->data, "Make SPNEGO Initial Token succeeded\n");
} }
} }
#endif #endif

View File

@ -61,11 +61,11 @@ char *appendstring(char *string, /* original string */
{ {
size_t len = strlen(buffer); size_t len = strlen(buffer);
size_t needed_len = len + *stringlen + 1; size_t needed_len = len + *stringlen + 1;
unsigned char *buf64=NULL; char *buf64=NULL;
if(base64) { if(base64) {
/* decode the given buffer first */ /* decode the given buffer first */
len = Curl_base64_decode(buffer, &buf64); /* updated len */ len = Curl_base64_decode(buffer, (unsigned char**)&buf64); /* updated len */
buffer = buf64; buffer = buf64;
needed_len = len + *stringlen + 1; /* recalculate */ needed_len = len + *stringlen + 1; /* recalculate */
} }
@ -79,8 +79,11 @@ char *appendstring(char *string, /* original string */
string = newptr; string = newptr;
*stralloc = newsize; *stralloc = newsize;
} }
else else {
if(buf64)
free(buf64);
return NULL; return NULL;
}
} }
/* memcpy to support binary blobs */ /* memcpy to support binary blobs */
memcpy(&string[*stringlen], buffer, len); memcpy(&string[*stringlen], buffer, len);