mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-01 11:12:08 +00:00
libselinux: free memory on selabel_open(3) failure
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")
Acked-by: James Carter <jwcart2@gmail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
63df12fec1
commit
b9a4d13a30
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user