1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

use goto to free resource

This commit is contained in:
winlin 2014-03-02 09:48:30 +08:00
parent feaf0c5e89
commit b7a62ba131
3 changed files with 18 additions and 9 deletions

View file

@ -39,17 +39,17 @@ struct Context
{
std::string url;
SrsRtmpClient* rtmp;
SimpleSocketStream* stream;
SimpleSocketStream* skt;
int stream_id;
Context() {
rtmp = NULL;
stream = NULL;
skt = NULL;
stream_id = 0;
}
virtual ~Context() {
srs_freep(rtmp);
srs_freep(stream);
srs_freep(skt);
}
};
@ -66,11 +66,18 @@ srs_rtmp_t srs_rtmp_create(const char* url){
void srs_rtmp_destroy(srs_rtmp_t rtmp){
srs_assert(rtmp != NULL);
Context* context = (Context*)rtmp;
srs_freep(context);
}
int srs_simple_handshake(srs_rtmp_t rtmp)
{
srs_assert(rtmp != NULL);
Context* context = (Context*)rtmp;
srs_freep(context->skt);
context->skt = new SimpleSocketStream();
return ERROR_SUCCESS;
}