Merge "AST-2018-005: Fix tdata leaks when calling pjsip_endpt_send_response(2)"
[asterisk/asterisk.git] / apps / app_dumpchan.c
index 93a6506..bec7788 100644 (file)
@@ -34,8 +34,6 @@
 
 #include "asterisk.h"
 
-ASTERISK_REGISTER_FILE()
-
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/channel.h"
@@ -72,7 +70,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
 {
        long elapsed_seconds = 0;
        int hour = 0, min = 0, sec = 0;
-       struct ast_str *format_buf = ast_str_alloca(64);
+       struct ast_str *format_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
        char cgrp[256];
        char pgrp[256];
        struct ast_str *write_transpath = ast_str_alloca(256);
@@ -90,8 +88,6 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
 
        ast_channel_lock(c);
        bridge = ast_channel_get_bridge(c);
-       ast_channel_unlock(c);
-
        snprintf(buf,size,
                "Name=               %s\n"
                "Type=               %s\n"
@@ -168,7 +164,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
                ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)",
                ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)",
                (ast_test_flag(ast_channel_flags(c), AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)"));
-
+       ast_channel_unlock(c);
        ao2_cleanup(bridge);
        return 0;
 }