From 81ad7562a3fa7453ce1b47e4827985277863ce27 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 29 May 2015 12:12:07 +0800 Subject: [PATCH] CID:1301050 fix possible NULL --- src/mod/endpoints/mod_rtmp/mod_rtmp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 76360e5641..b67f326b82 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -1713,12 +1713,14 @@ SWITCH_STANDARD_API(rtmp_function) } } else if (!strcmp(argv[2], "rescan")) { rtmp_profile_t *profile = rtmp_profile_locate(argv[1]); - if (config_profile(profile, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "+OK\n"); - } else { - stream->write_function(stream, "-ERR Config error\n"); + if (profile) { + if (config_profile(profile, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK\n"); + } else { + stream->write_function(stream, "-ERR Config error\n"); + } + rtmp_profile_release(profile); } - rtmp_profile_release(profile); } else if (!strcmp(argv[2], "restart")) { rtmp_profile_t *profile = rtmp_profile_locate(argv[1]); if (profile) {