Skip to content

Commit

Permalink
check all malloc returns
Browse files Browse the repository at this point in the history
  • Loading branch information
ardera committed Oct 21, 2023
1 parent 6a28738 commit 6566dec
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pluginregistry.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ static int set_receiver_locked(
struct platch_obj_cb_data *data;

data = malloc(sizeof *data);
if (data == NULL) {
free(channel_dup);
return ENOMEM;
}

data->channel = channel_dup;
data->codec = codec;
data->callback = callback;
Expand Down Expand Up @@ -474,6 +479,8 @@ void static_plugin_registry_add_plugin(const struct flutterpi_plugin_v2 *plugin)
ASSERT_ZERO(ok);

entry = malloc(sizeof *entry);
ASSERT_NOT_NULL(entry);

entry->plugin = plugin;

list_addtail(&entry->entry, &static_plugins);
Expand Down

0 comments on commit 6566dec

Please sign in to comment.