1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

http: fix a memory leakage in checkrtspprefix().

This commit is contained in:
Patrick Monnerat 2017-09-02 12:40:19 +01:00
parent 57001ce3bb
commit 3b51fa6285

View File

@ -2809,6 +2809,7 @@ static bool
checkrtspprefix(struct Curl_easy *data, checkrtspprefix(struct Curl_easy *data,
const char *s) const char *s)
{ {
bool result = FALSE;
#ifdef CURL_DOES_CONVERSIONS #ifdef CURL_DOES_CONVERSIONS
/* convert from the network encoding using a scratch area */ /* convert from the network encoding using a scratch area */
@ -2819,16 +2820,17 @@ checkrtspprefix(struct Curl_easy *data,
} }
if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) { if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) {
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
free(scratch); result = FALSE; /* can't return CURLE_foobar so return FALSE */
return FALSE; /* can't return CURLE_foobar so return FALSE */
} }
s = scratch; else
result = checkprefix("RTSP/", scratch)? TRUE: FALSE;
free(scratch);
#else #else
(void)data; /* unused */ (void)data; /* unused */
result = checkprefix("RTSP/", s)? TRUE: FALSE;
#endif /* CURL_DOES_CONVERSIONS */ #endif /* CURL_DOES_CONVERSIONS */
if(checkprefix("RTSP/", s))
return TRUE; return result;
return FALSE;
} }
#endif /* CURL_DISABLE_RTSP */ #endif /* CURL_DISABLE_RTSP */