From 2b5b55f416ff6089e6a947ba84d1822a5a097ef1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 4 Sep 2023 11:01:46 +0900 Subject: [PATCH] [iqm] Check frames before freeing its buffer Fixes a segfault on shutdown when the iqm model has no animation data. --- libs/models/iqm/model_iqm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/models/iqm/model_iqm.c b/libs/models/iqm/model_iqm.c index 147bf8dba..db38c954d 100644 --- a/libs/models/iqm/model_iqm.c +++ b/libs/models/iqm/model_iqm.c @@ -533,8 +533,10 @@ Mod_FreeIQM (iqm_t *iqm) free (iqm->baseframe); free (iqm->inverse_baseframe); free (iqm->anims); - free (iqm->frames[0]); - free (iqm->frames); + if (iqm->frames) { + free (iqm->frames[0]); + free (iqm->frames); + } free (iqm); }