]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fix uninitialized use of length variable
authorTravis Cross <tc@traviscross.com>
Wed, 3 Jul 2013 15:58:46 +0000 (15:58 +0000)
committerTravis Cross <tc@traviscross.com>
Wed, 3 Jul 2013 16:05:07 +0000 (16:05 +0000)
Bad things must have been happening when this was hit.

This was introduced in commit 5cb4cd9d9cef91d172c36e827a6bf1640fdca968

src/switch_ivr_async.c

index 6566670848ade5a3e1f341e1f356a83b175f4de7..18d4a3fcca8ba324cfaf586320257066080eceec 100644 (file)
@@ -1132,6 +1132,9 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                        switch_time_t diff;
                        rh->wready = 1;
                        
+                       nframe = switch_core_media_bug_get_native_write_frame(bug);
+                       len = nframe->datalen;
+
                        if (!rh->rready) {
                                unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
                                switch_size_t fill_len = len;
@@ -1140,8 +1143,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
                        }
 
 
-                       nframe = switch_core_media_bug_get_native_write_frame(bug);
-                       len = nframe->datalen;
                        
 
                        if (rh->last_write_time && rh->last_write_time < now) {