dtc/pylibfdt
Luca Weiss d152126bb0 Fix Python crash on getprop deallocation
Fatal Python error: none_dealloc: deallocating None
Python runtime state: finalizing (tstate=0x000055c9bac70920)

Current thread 0x00007fbe34e47740 (most recent call first):
  <no Python frame>
Aborted (core dumped)

This is caused by a missing Py_INCREF on the returned Py_None, as
demonstrated e.g. in https://github.com/mythosil/swig-python-incref or
described at https://edcjones.tripod.com/refcount.html ("Remember to
INCREF Py_None!")

A PoC for triggering this crash is uploaded to
https://github.com/z3ntu/pylibfdt-crash .
With this patch applied to pylibfdt the crash does not happen.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Message-Id: <20211224102811.70695-1-luca@z3ntu.xyz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-12-26 15:44:32 +11:00
..
.gitignore Use Python3 by default 2019-03-29 15:43:24 +11:00
libfdt.i Fix Python crash on getprop deallocation 2021-12-26 15:44:32 +11:00
Makefile.pylibfdt pylibfdt: Move setup.py to the top level 2021-11-11 14:34:51 +11:00
meson.build pylibfdt: Move setup.py to the top level 2021-11-11 14:34:51 +11:00