]> arthur.barton.de Git - bup.git/commit
Fix memory leak in *stat calls in _helpers.c
authorAidan Hobson Sayers <aidanhs@cantab.net>
Fri, 10 Jan 2020 11:12:27 +0000 (11:12 +0000)
committerRob Browning <rlb@defaultvalue.org>
Sat, 25 Apr 2020 19:12:24 +0000 (14:12 -0500)
commit0a4e906e732556fad6422f93532fed1d261585ee
treeddbe51d62c28e6e0bcf7a4fac3eb608075711e55
parentc5b8974d7aec4fef779468d99f96da3a04b6f04f
Fix memory leak in *stat calls in _helpers.c

The Python documentation [0] indicates that an 'O' passed to
Py_BuildValue will have its refcount incremented. Since some elements of
the tuple created in stat_struct_to_py are pre-converted in C to
PyObjects, they already have a refcount of 1 - use 'N' to avoid
incrementing it and ensure Python can deallocate them correctly.

[0] https://docs.python.org/2/c-api/arg.html?highlight=py_buildvalue#c.Py_BuildValue

Signed-off-by: Aidan Hobson Sayers <aidanhs@cantab.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
(cherry picked from commit 3c57e31f68b3e68bf7053a628fcfd7ccccf217cd)
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/_helpers.c