summaryrefslogtreecommitdiff
path: root/res/res_monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_monitor.c')
-rw-r--r--res/res_monitor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 5482f549c..9aca24a0d 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -378,7 +378,9 @@ int AST_OPTIONAL_API_NAME(ast_monitor_start)(struct ast_channel *chan, const cha
O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
ast_log(LOG_WARNING, "Could not create file %s\n",
monitor->write_filename);
- ast_closestream(monitor->read_stream);
+ if (monitor->read_stream) {
+ ast_closestream(monitor->read_stream);
+ }
ast_free(monitor);
UNLOCK_IF_NEEDED(chan, need_lock);
return -1;