mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 16:18:48 -05:00
OOM handling fix
This commit is contained in:
parent
2c2464a682
commit
0f4a91afde
31
lib/rtsp.c
31
lib/rtsp.c
@ -127,8 +127,9 @@ CURLcode Curl_rtsp_disconnect(struct connectdata *conn) {
|
|||||||
CURLcode Curl_rtsp_done(struct connectdata *conn,
|
CURLcode Curl_rtsp_done(struct connectdata *conn,
|
||||||
CURLcode status, bool premature)
|
CURLcode status, bool premature)
|
||||||
{
|
{
|
||||||
CURLcode httpStatus;
|
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
|
struct RTSP *rtsp = data->state.proto.rtsp;
|
||||||
|
CURLcode httpStatus;
|
||||||
long CSeq_sent;
|
long CSeq_sent;
|
||||||
long CSeq_recv;
|
long CSeq_recv;
|
||||||
|
|
||||||
@ -138,18 +139,20 @@ CURLcode Curl_rtsp_done(struct connectdata *conn,
|
|||||||
|
|
||||||
httpStatus = Curl_http_done(conn, status, premature);
|
httpStatus = Curl_http_done(conn, status, premature);
|
||||||
|
|
||||||
/* Check the sequence numbers */
|
if(rtsp) {
|
||||||
CSeq_sent = data->state.proto.rtsp->CSeq_sent;
|
/* Check the sequence numbers */
|
||||||
CSeq_recv = data->state.proto.rtsp->CSeq_recv;
|
CSeq_sent = rtsp->CSeq_sent;
|
||||||
if((data->set.rtspreq != RTSPREQ_RECEIVE) && (CSeq_sent != CSeq_recv)) {
|
CSeq_recv = rtsp->CSeq_recv;
|
||||||
failf(data, "The CSeq of this request %ld did not match the response %ld",
|
if((data->set.rtspreq != RTSPREQ_RECEIVE) && (CSeq_sent != CSeq_recv)) {
|
||||||
CSeq_sent, CSeq_recv);
|
failf(data, "The CSeq of this request %ld did not match the response %ld",
|
||||||
return CURLE_RTSP_CSEQ_ERROR;
|
CSeq_sent, CSeq_recv);
|
||||||
}
|
return CURLE_RTSP_CSEQ_ERROR;
|
||||||
else if (data->set.rtspreq == RTSPREQ_RECEIVE &&
|
}
|
||||||
(conn->proto.rtspc.rtp_channel == -1)) {
|
else if(data->set.rtspreq == RTSPREQ_RECEIVE &&
|
||||||
infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv);
|
(conn->proto.rtspc.rtp_channel == -1)) {
|
||||||
/* TODO CPC: Server -> Client logic here */
|
infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv);
|
||||||
|
/* TODO CPC: Server -> Client logic here */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return httpStatus;
|
return httpStatus;
|
||||||
@ -418,6 +421,8 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done)
|
|||||||
p_range ? p_range : "",
|
p_range ? p_range : "",
|
||||||
p_referrer ? p_referrer : "",
|
p_referrer ? p_referrer : "",
|
||||||
p_uagent ? p_uagent : "");
|
p_uagent ? p_uagent : "");
|
||||||
|
if(result)
|
||||||
|
return result;
|
||||||
|
|
||||||
if((rtspreq == RTSPREQ_SETUP) || (rtspreq == RTSPREQ_DESCRIBE)) {
|
if((rtspreq == RTSPREQ_SETUP) || (rtspreq == RTSPREQ_DESCRIBE)) {
|
||||||
result = Curl_add_timecondition(data, req_buffer);
|
result = Curl_add_timecondition(data, req_buffer);
|
||||||
|
@ -95,6 +95,9 @@ int test(char *URL)
|
|||||||
|
|
||||||
test_cleanup:
|
test_cleanup:
|
||||||
|
|
||||||
|
if(stream_uri)
|
||||||
|
free(stream_uri);
|
||||||
|
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ int test(char *URL)
|
|||||||
CURL *curl;
|
CURL *curl;
|
||||||
char *stream_uri = NULL;
|
char *stream_uri = NULL;
|
||||||
int request=1;
|
int request=1;
|
||||||
FILE *protofile;
|
FILE *protofile = NULL;
|
||||||
|
|
||||||
protofile = fopen(libtest_arg2, "wb");
|
protofile = fopen(libtest_arg2, "wb");
|
||||||
if(protofile == NULL) {
|
if(protofile == NULL) {
|
||||||
@ -109,8 +109,8 @@ int test(char *URL)
|
|||||||
|
|
||||||
if ((curl = curl_easy_init()) == NULL) {
|
if ((curl = curl_easy_init()) == NULL) {
|
||||||
fprintf(stderr, "curl_easy_init() failed\n");
|
fprintf(stderr, "curl_easy_init() failed\n");
|
||||||
curl_global_cleanup();
|
|
||||||
fclose(protofile);
|
fclose(protofile);
|
||||||
|
curl_global_cleanup();
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
test_setopt(curl, CURLOPT_URL, URL);
|
test_setopt(curl, CURLOPT_URL, URL);
|
||||||
@ -163,7 +163,10 @@ int test(char *URL)
|
|||||||
if(res)
|
if(res)
|
||||||
goto test_cleanup;
|
goto test_cleanup;
|
||||||
|
|
||||||
stream_uri = suburl(URL, request++);
|
if((stream_uri = suburl(URL, request++)) == NULL) {
|
||||||
|
res = TEST_ERR_MAJOR_BAD;
|
||||||
|
goto test_cleanup;
|
||||||
|
}
|
||||||
test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
|
test_setopt(curl, CURLOPT_RTSP_STREAM_URI, stream_uri);
|
||||||
free(stream_uri);
|
free(stream_uri);
|
||||||
stream_uri = NULL;
|
stream_uri = NULL;
|
||||||
@ -184,7 +187,11 @@ int test(char *URL)
|
|||||||
|
|
||||||
test_cleanup:
|
test_cleanup:
|
||||||
|
|
||||||
fclose(protofile);
|
if(stream_uri)
|
||||||
|
free(stream_uri);
|
||||||
|
|
||||||
|
if(protofile)
|
||||||
|
fclose(protofile);
|
||||||
|
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
|
Loading…
Reference in New Issue
Block a user