From: Gerhard Sittig Date: Fri, 9 Jun 2017 21:13:35 +0000 (+0200) Subject: C++ binding: Fixup memory leak in input module receive() calls X-Git-Tag: libsigrok-0.5.0~8 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e3e1f20c7f5071fb9d1912619a899e542c5d9c71;p=libsigrok.git C++ binding: Fixup memory leak in input module receive() calls The Input::send() method allocated glib strings and copied input data, but only released the glib string container and leaked the actual string content. This led to leaks in the size of the verbatim input file, which is especially wasteful for uncompressed textual representations. This fixes bug #976. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 03b81edb..e4340fdf 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -1407,7 +1407,7 @@ void Input::send(void *data, size_t length) { auto gstr = g_string_new_len(static_cast(data), length); auto ret = sr_input_send(_structure, gstr); - g_string_free(gstr, false); + g_string_free(gstr, true); check(ret); }