From 1943d0b44e8f9d9bb3172fc95881829cd3665f4a Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Tue, 25 Aug 2015 13:47:57 +0000 Subject: [PATCH] mosquitto: fix crash on client disconnect Patch backported from upstream. Was only noticed on musl and freebsd clients. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=475707 Fixes github issue #1692 Signed-off-by: Karl Palsson --- net/mosquitto/Makefile | 2 +- .../patches/001-free-counting-bug-475707.patch | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 net/mosquitto/patches/001-free-counting-bug-475707.patch diff --git a/net/mosquitto/Makefile b/net/mosquitto/Makefile index 05348aeb8..1aac9d872 100644 --- a/net/mosquitto/Makefile +++ b/net/mosquitto/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mosquitto PKG_VERSION:=1.4.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE.txt diff --git a/net/mosquitto/patches/001-free-counting-bug-475707.patch b/net/mosquitto/patches/001-free-counting-bug-475707.patch new file mode 100644 index 000000000..6b1614569 --- /dev/null +++ b/net/mosquitto/patches/001-free-counting-bug-475707.patch @@ -0,0 +1,14 @@ +diff --git a/lib/memory_mosq.c b/lib/memory_mosq.c +index b1f5bfd..4d8217d 100644 +--- a/lib/memory_mosq.c ++++ b/lib/memory_mosq.c +@@ -54,6 +54,9 @@ void *mosquitto__calloc(size_t nmemb, size_t size) + void mosquitto__free(void *mem) + { + #ifdef REAL_WITH_MEMORY_TRACKING ++ if(!mem){ ++ return; ++ } + memcount -= malloc_usable_size(mem); + #endif + free(mem);