[PATCH] ipcpd: Fix bad index in packet scheduler

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Thu, 28 May 2020 17:07:30 +0200

GCC 10 static analyzer found that the wrong index was used in the fail
path of psched_create, causing double (multiple) frees.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/ipcpd/unicast/psched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ipcpd/unicast/psched.c b/src/ipcpd/unicast/psched.c
index 1ac3fc1..898e6b2 100644
--- a/src/ipcpd/unicast/psched.c
+++ b/src/ipcpd/unicast/psched.c
@@ -160,7 +160,7 @@ struct psched * psched_create(next_packet_fn_t callback)
                         for (j = 0; j < i; ++j)
                                 pthread_join(psched->readers[j], NULL);
                         for (j = i; j < QOS_CUBE_MAX * IPCP_SCHED_THR_MUL; ++j)
-                                free(infos[i]);
+                                free(infos[j]);
                         goto fail_infos;
                 }
         }
-- 
2.26.2


Other related posts:

  • » [PATCH] ipcpd: Fix bad index in packet scheduler - Dimitri Staessens