snap-policy: fix memory leak

This patch fixes a memory leak when there is a snap with an
invalid ID.
This commit is contained in:
Sergio Costas Rodriguez 2024-02-02 17:30:16 +01:00 committed by Wim Taymans
parent fed1432172
commit 4d3658b271

View file

@ -83,6 +83,7 @@ pw_sandbox_access_t pw_snap_get_audio_permissions(struct client *client, int fd,
snap_id = g_strdup(aa_label + strlen(SNAP_LABEL_PREFIX)); snap_id = g_strdup(aa_label + strlen(SNAP_LABEL_PREFIX));
separator = strchr(snap_id, '.'); separator = strchr(snap_id, '.');
if (separator == NULL) { if (separator == NULL) {
g_free(snap_id);
pw_log_info("snap_get_audio_permissions: aa_label has only one dot; not a valid ID."); pw_log_info("snap_get_audio_permissions: aa_label has only one dot; not a valid ID.");
return PW_SANDBOX_ACCESS_NONE; return PW_SANDBOX_ACCESS_NONE;
} }