From c06ec0bea8157512e73b95592c21a48dd875718c Mon Sep 17 00:00:00 2001 From: Bo Date: Tue, 7 May 2024 00:15:43 +0100 Subject: [PATCH] fix leak counter error when freeing a `NULL` mustache object --- fio-stl.h | 2 ++ fio-stl/104 mustache.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/fio-stl.h b/fio-stl.h index 57411e4..7af863d 100644 --- a/fio-stl.h +++ b/fio-stl.h @@ -20733,6 +20733,8 @@ SFUNC fio_mustache_s *fio_mustache_load FIO_NOOP(fio_mustache_load_args_s a) { /* Frees the mustache template object (or reduces it's reference count). */ SFUNC void fio_mustache_free(fio_mustache_s *m) { + if (!m) + return; FIO_LEAK_COUNTER_ON_FREE(fio_mustache_s); fio_bstr_free((char *)m); } diff --git a/fio-stl/104 mustache.h b/fio-stl/104 mustache.h index 49323bd..e1a1a38 100644 --- a/fio-stl/104 mustache.h +++ b/fio-stl/104 mustache.h @@ -1218,6 +1218,8 @@ SFUNC fio_mustache_s *fio_mustache_load FIO_NOOP(fio_mustache_load_args_s a) { /* Frees the mustache template object (or reduces it's reference count). */ SFUNC void fio_mustache_free(fio_mustache_s *m) { + if (!m) + return; FIO_LEAK_COUNTER_ON_FREE(fio_mustache_s); fio_bstr_free((char *)m); }