From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx> free allocated memory before exit --- src/shared/ringbuf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/shared/ringbuf.c b/src/shared/ringbuf.c index 3e5c7d3..d59dc5c 100644 --- a/src/shared/ringbuf.c +++ b/src/shared/ringbuf.c @@ -228,9 +228,14 @@ int ringbuf_vprintf(struct ringbuf *ringbuf, const char *format, va_list ap) return -1; len = vasprintf(&str, format, ap); - if (len < 0 || (size_t) len > avail) + if (len < 0) return -1; + if ((size_t) len > avail) { + free(str); + return -1; + } + /* Determine possible length of string before wrapping */ offset = ringbuf->in & (ringbuf->size - 1); end = MIN((size_t) len, ringbuf->size - offset); -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html