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,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_publish_stream(rtmp) != 0) {
printf("publish stream failed.\n");
return -1;
goto rtmp_destroy;
}
printf("publish stream success\n");
rtmp_destroy:
srs_rtmp_destroy(rtmp);
return 0;