diff --git a/main/channel.c b/main/channel.c
index cb57ac6296b42a8a6e592e71943b83667599a6fc..fbb14d8ae5e6a669858637d60ac787cff78b7ef7 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2286,7 +2286,7 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
 		 * avoidance not to work in deeper functions
 		 */
 		ast_channel_unlock(chan);
-		res = generate(chan, tmp, f->datalen, f->samples);
+		res = generate(chan, tmp, f->datalen, samples);
 		ast_channel_lock(chan);
 		chan->generatordata = tmp;
 		if (res) {