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:
parent
feaf0c5e89
commit
b7a62ba131
3 changed files with 18 additions and 9 deletions
|
@ -39,22 +39,23 @@ int main(int argc, char** argv)
|
|||
|
||||
if (srs_simple_handshake(rtmp) != 0) {
|
||||
printf("simple handshake failed.\n");
|
||||
return -1;
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
printf("simple handshake success\n");
|
||||
|
||||
if (srs_connect_app(rtmp) != 0) {
|
||||
printf("connect vhost/app failed.\n");
|
||||
return -1;
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
printf("connect vhost/app success\n");
|
||||
|
||||
if (srs_play_stream(rtmp) != 0) {
|
||||
printf("play stream failed.\n");
|
||||
return -1;
|
||||
goto rtmp_destroy;
|
||||
}
|
||||
printf("play stream success\n");
|
||||
|
||||
rtmp_destroy:
|
||||
srs_rtmp_destroy(rtmp);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue