Avoid memory leak in rmtree() when path cannot be opened
commitf1e9f6bbfa536992eac6c094882b3afcd9e90fb4
authorMichael Paquier <michael@paquier.xyz>
Mon, 31 Jul 2023 02:36:44 +0000 (31 11:36 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 31 Jul 2023 02:36:44 +0000 (31 11:36 +0900)
tree9a9396f0885689da09dfdd42a17e64c6153787e9
parentbf227926d22b5cffba4b6724df0eb239a7037cbd
Avoid memory leak in rmtree() when path cannot be opened

An allocation done for the directory names to recurse into for their
deletion was done before OPENDIR(), so, assuming that a failure happens,
this could leak a bit of memory.

Author: Ranier Vilela
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/CAEudQAoN3-2ZKBALThnEk_q2hu8En5A0WG9O+5siJTQKVZzoWQ@mail.gmail.com
src/common/rmtree.c