Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kmod): free node_name to avoid memory leak #483

Merged
merged 1 commit into from
Mar 6, 2025
Merged
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
5 changes: 5 additions & 0 deletions agnocast_kmod/agnocast_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,7 @@ static void pre_handler_subscriber_exit(struct topic_wrapper * wrapper, const pi

const topic_local_id_t subscriber_id = sub_info->id;
hash_del(&sub_info->node);
kfree(sub_info->node_name);
kfree(sub_info);

struct rb_root * root = &wrapper->topic.entries;
Expand Down Expand Up @@ -1861,6 +1862,7 @@ static void pre_handler_subscriber_exit(struct topic_wrapper * wrapper, const pi
pub_info->entries_num--;
if (pub_info->entries_num == 0) {
hash_del(&pub_info->node);
kfree(pub_info->node_name);
kfree(pub_info);
}
}
Expand Down Expand Up @@ -1892,6 +1894,7 @@ static void pre_handler_publisher_exit(struct topic_wrapper * wrapper, const pid

if (pub_info->entries_num == 0) {
hash_del(&pub_info->node);
kfree(pub_info->node_name);
kfree(pub_info);
}
}
Expand Down Expand Up @@ -2121,6 +2124,7 @@ static void remove_all_topics(void)
hash_for_each_safe(wrapper->topic.pub_info_htable, bkt_pub_info, tmp_pub_info, pub_info, node)
{
hash_del(&pub_info->node);
kfree(pub_info->node_name);
kfree(pub_info);
}

Expand All @@ -2130,6 +2134,7 @@ static void remove_all_topics(void)
hash_for_each_safe(wrapper->topic.sub_info_htable, bkt_sub_info, tmp_sub_info, sub_info, node)
{
hash_del(&sub_info->node);
kfree(sub_info->node_name);
kfree(sub_info);
}

Expand Down