Message ID | 20220413155633.62677-2-cgzones@googlemail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | b9a4d13a3006 |
Headers | show |
Series | [1/3] libselinux: correct parameter type in selabel_open(3) | expand |
diff --git a/libselinux/src/label.c b/libselinux/src/label.c index a03192e5..586e5e5e 100644 --- a/libselinux/src/label.c +++ b/libselinux/src/label.c @@ -226,6 +226,8 @@ struct selabel_handle *selabel_open(unsigned int backend, rec->digest = selabel_is_digest_set(opts, nopts, rec->digest); if ((*initfuncs[backend])(rec, opts, nopts)) { + if (rec->digest) + selabel_digest_fini(rec->digest); free(rec->spec_file); free(rec); rec = NULL;
If selabel_open(3) fails, e.g. when a specfile has the wrong file permissions, free the memory allocated for digests. Fixes: e40bbea9 ("libselinux: Add selabel_digest function") Signed-off-by: Christian Göttsche <cgzones@googlemail.com> --- libselinux/src/label.c | 2 ++ 1 file changed, 2 insertions(+)