Fix double free in label monitor
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 24 Oct 2024 08:03:39 +0000 (10:03 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 24 Oct 2024 10:15:16 +0000 (12:15 +0200)
commit3417683026cb15b51c61b4991d48c3d6966076b7
tree4f881ae3f5c3c59f293bcb62becdbfc707f7b62b
parentb33ee5139ed656351d5217e18c977dc6e299682a
Fix double free in label monitor

The pointer passed to initialize_inotify() is already managed by a unique_ptr.
In case of initialize_inotify() failure the pointer was being passed to
security_manager_app_labels_monitor_finish() where it was wrapped in a
unique_ptr again.

Add a helper non-throwing function operating on raw app_labels_monitor pointer
for properly closing it. Use it in security_manager_app_labels_monitor_finish()
and security_manager_app_labels_monitor_init().

Change-Id: I6f3b5883fde53ba3ded7764f3121f59ace053a10
src/client/client-label-monitor.cpp