libotutil: Avoid infinite recursion during error unwinding
authorSimon McVittie <smcv@collabora.com>
Fri, 28 Jan 2022 11:08:00 +0000 (11:08 +0000)
committerSimon McVittie <smcv@debian.org>
Thu, 10 Mar 2022 11:59:18 +0000 (11:59 +0000)
commiteb3852972cef9d194faa3a1deb11e0b2016ea671
tree79b8c4fc5d52739da405895a6c97c891ef82473f
parent628fa27cce0a68d0483ab1b54db477256b172007
libotutil: Avoid infinite recursion during error unwinding

When we clean up from an error, for example copy_file_range() failing
while we generate a static delta (perhaps caused by
https://gitlab.gnome.org/GNOME/libglnx/-/issues/3 or by a
genuine write error), we might free a variant builder that has a
non-null parent. Previously, this caused infinite recursion and a stack
overflow, repeatedly freeing the same object, but Luca Bruno suggested
that the intention here appears to have been to free the parent object.

Partially resolves https://github.com/ostreedev/ostree/issues/2525
(the other bug reported in that issue needs to be resolved by updating
libglnx to a version where libglnx#3 has been fixed).

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug: https://github.com/ostreedev/ostree/issues/2525
Applied-upstream: 2022.2, commit:920f85cabc656e4a7c07574aa9af211b6153756d

Gbp-Pq: Name libotutil-Avoid-infinite-recursion-during-error-unwinding.patch
src/libotutil/ot-variant-builder.c