diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c
index cc879367fd6f87bae3161b108363aa68abbb8915..11d3f209337e0d596bd21a6fe5e714d171dce1fc 100644
--- a/libavcodec/g722enc.c
+++ b/libavcodec/g722enc.c
@@ -196,7 +196,7 @@ static void g722_encode_trellis(G722Context *c, int trellis,
     for (i = 0; i < 2; i++) {
         nodes[i] = c->nodep_buf[i];
         nodes_next[i] = c->nodep_buf[i] + frontier;
-        memset(c->nodep_buf[i], 0, 2 * frontier * sizeof(*c->nodep_buf));
+        memset(c->nodep_buf[i], 0, 2 * frontier * sizeof(*c->nodep_buf[i]));
         nodes[i][0] = c->node_buf[i] + frontier;
         nodes[i][0]->ssd = 0;
         nodes[i][0]->path = 0;