Skip to content

Commit

Permalink
landlock: simplify variables in ll_add_profile
Browse files Browse the repository at this point in the history
This amends commit 520508d ("landlock: avoid parsing landlock commands
twice", 2023-11-02) / PR #6078.
  • Loading branch information
kmk3 committed Dec 5, 2023
1 parent e750f3e commit 24b88ce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/firejail/landlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,15 @@ void ll_add_profile(int type, const char *data) {
if (!ll_is_supported())
return;

const char *str = data;
while (*str == ' ' || *str == '\t')
str++;
while (*data == ' ' || *data == '\t')
data++;

LandlockEntry *ptr = malloc(sizeof(LandlockEntry));
if (!ptr)
errExit("malloc");
memset(ptr, 0, sizeof(LandlockEntry));
ptr->type = type;
ptr->data = strdup(str);
ptr->data = strdup(data);
if (!ptr->data)
errExit("strdup");
ptr->next = cfg.lprofile;
Expand Down

0 comments on commit 24b88ce

Please sign in to comment.