Valgrind indicated that 253,052 bytes where definitely lost when running
lsoptdepends. Valgrind reports before and after:

- definitely lost: 253,052 bytes in 4,979 blocks
- definitely lost: 48 bytes in 2 blocks

Signed-off-by: Jelle van der Waa <je...@vdwaa.nl>
---

Changes since v2:
 * Check if vasprintf allocated memory.

 src/options.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/options.c b/src/options.c
index 0dad965..2637c9d 100644
--- a/src/options.c
+++ b/src/options.c
@@ -340,6 +340,7 @@ void pyalpm_logcb(alpm_loglevel_t level, const char *fmt, 
va_list va_args) {
   if(ret == -1)
     log = "pyalpm_logcb: could not allocate memory";
   result = PyObject_CallFunction(global_py_callbacks[CB_LOG], "is", level, 
log);
+  if (ret != -1) free(log);
   if (!result) PyErr_Print();
   Py_CLEAR(result);
 }
-- 
2.10.0

Reply via email to