Skip to content

Commit

Permalink
launch/policy: deallocate unused records during import
Browse files Browse the repository at this point in the history
When records are imported, but never linked to any policy list, we
currently leak the records. Fix this and properly deallocate the records
in those cases.

Note that this only happens when invalid uids/gids are specified, which
is not common for production systems.

Reported-by: Evgeny Vereshchagin <[email protected]>
Reported-by: Frantisek Sumsal <[email protected]>
Signed-off-by: David Rheinsberg <[email protected]>
  • Loading branch information
dvdhrm committed Aug 2, 2024
1 parent 09836cb commit fedceff
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/launch/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ static int policy_import_own(Policy *policy, ConfigNode *cnode) {
c_list_link_tail(&policy->default_entries.own_list, &record->link);
}

record = NULL;
if (c_list_is_linked(&record->link))
record = NULL;
return 0;
}

Expand Down Expand Up @@ -497,7 +498,8 @@ static int policy_import_send(Policy *policy, ConfigNode *cnode) {
c_list_link_tail(&policy->default_entries.send_list, &record->link);
}

record = NULL;
if (c_list_is_linked(&record->link))
record = NULL;
return 0;
}

Expand Down Expand Up @@ -589,7 +591,8 @@ static int policy_import_recv(Policy *policy, ConfigNode *cnode) {
c_list_link_tail(&policy->default_entries.recv_list, &record->link);
}

record = NULL;
if (c_list_is_linked(&record->link))
record = NULL;
return 0;
}

Expand Down

0 comments on commit fedceff

Please sign in to comment.