Skip to content

Commit

Permalink
ensure pointer slot is freed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryptkeeper committed Jul 5, 2024
1 parent 2eb0e71 commit 1b67e56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
#include "sl.h"

static void lcmdfree(struct lcmdset_s* cmd) {
for (size_t i = 0; cmd->fpatterns[i] != NULL; i++) regfree(cmd->fpatterns[i]);
for (size_t i = 0; cmd->fpatterns[i] != NULL; i++) {
regex_t* reg = cmd->fpatterns[i];
if (reg == NULL) continue;
regfree(reg);
free(reg);
}
free(cmd->fpatterns);
slfree(cmd->syscmds);
free(cmd);
Expand Down

0 comments on commit 1b67e56

Please sign in to comment.