[arch-projects] [pyalpm][PATCH] free log when it's no longer required

Jelle van der Waa jelle at vdwaa.nl
Mon Oct 10 19:13:14 UTC 2016


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 <jelle at vdwaa.nl>
---
 src/options.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/options.c b/src/options.c
index 0dad965..cdbe4e0 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);
+  free(log);
   if (!result) PyErr_Print();
   Py_CLEAR(result);
 }
-- 
2.10.0


More information about the arch-projects mailing list