Open
Description
edrav2/eprj/curl/lib/escape.c
char *curl_easy_escape(struct Curl_easy *data, const char *string,
int inlength)
{
....
alloc = (inlength?(size_t)inlength:strlen(string)) + 1;
newlen = alloc;
//malloc the ns memery
ns = malloc(alloc);
if(!ns)
return NULL;
//malloc ok
length = alloc-1;
while(length--) {
unsigned char in = string; / we need to treat the characters unsigned */
if(Curl_isunreserved(in))
/* just copy this */
ns[strindex++] = in;
else {
/* encode it */
newlen += 2; /* the size grows with two, since this'll become a %XX */
if(newlen > alloc) {
alloc *= 2;
testing_ptr = Curl_saferealloc(ns, alloc);
if(!testing_ptr)
return NULL;
// Here will cause the memery leak.
.....
}
Metadata
Metadata
Assignees
Labels
No labels