Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ void event_init(pblog_Event *event) { memset(event, 0, sizeof(*event)); }

void event_free(pblog_Event *event) {
int i = 0;

if (event == NULL)
return;

for (i = 0; i < event->data_count; ++i) {
free(event->data[i].key.arg);
event->data[i].key.arg = NULL;
Expand Down
7 changes: 7 additions & 0 deletions src/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ static const struct nvram_entry *find_key(const struct nvram_entry *entries,
}

void nvram_entry_free(struct nvram_entry *entry) {
if (entry == NULL)
return;

free(entry->key);
free(entry->data);
}
Expand Down Expand Up @@ -127,6 +130,10 @@ static int nvram_enumerate(struct nvram *nvram, struct nvram_entry **entries) {

void nvram_list_free(struct nvram_entry **entries) {
struct nvram_entry *entry;

if (*entries == NULL)
return;

for (entry = *entries; entry && entry->key != NULL; entry++) {
nvram_entry_free(entry);
}
Expand Down
7 changes: 6 additions & 1 deletion src/pblog.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,12 @@ int pblog_init(struct pblog *pblog, int allow_clear_on_add,
}

void pblog_free(struct pblog *pblog) {
struct pblog_metadata *meta = pblog->priv;
struct pblog_metadata *meta;

if (pblog == NULL)
return;

meta = pblog->priv;
record_intf_free(meta->mem_ri);
free(meta->mem_ri);
pblog_mem_ops.priv = NULL;
Expand Down
7 changes: 6 additions & 1 deletion src/record.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,12 @@ int record_intf_init(record_intf *ri, const struct record_region *regions,
}

void record_intf_free(record_intf *ri) {
struct log_metadata *meta = ri->priv;
struct log_metadata *meta;

if (ri == NULL)
return;

meta = ri->priv;
free(meta->regions);
free(meta);
}