]> 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>
Sun, 12 Jan 2020 16:27:25 +0000 (10:27 -0600)
commit3c57e31f68b3e68bf7053a628fcfd7ccccf217cd
tree401407d678338d6e6bbabc1222abdbfc1b702e44
parent14e8c3b8cbf49ecbc520cd52b3ae357658c7337d
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>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/_helpers.c