From: Jonathan Lebon Date: Wed, 7 Oct 2020 18:44:25 +0000 (-0400) Subject: lib/deploy: Don't leak fd when checksumming dtbs X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~7^2~3^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b3dc074f5ed6d3a1e40dbc1e3315a518512d3c63;p=ostree.git lib/deploy: Don't leak fd when checksumming dtbs Likely the root of https://bugzilla.redhat.com/show_bug.cgi?id=1886149. --- diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index 1c4fb5dc..7b7ba5e9 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -272,13 +272,13 @@ checksum_dir_recurse (int dfd, } else { - int fd; + glnx_autofd int fd = -1; if (!ot_openat_ignore_enoent (dfditer.fd, d_name, &fd, error)) return FALSE; if (fd != -1) { - g_autoptr(GInputStream) in = g_unix_input_stream_new (fd, FALSE); + g_autoptr(GInputStream) in = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE); if (!ot_gio_splice_update_checksum (NULL, in, checksum, cancellable, error)) return FALSE; }