Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed May 2, 2024
1 parent ef0e66b commit 8cd6aee
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zenoh/src/net/routing/hat/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ impl HatBaseTrait for HatCode {
fn close_face(&self, tables: &TablesLock, face: &mut Arc<FaceState>) {
let mut wtables = zwrite!(tables.tables);
let mut face_clone = face.clone();

face_hat_mut!(face).remote_sub_interests.clear();
face_hat_mut!(face).local_subs.clear();
face_hat_mut!(face).local_qabls.clear();

let face = get_mut_unchecked(face);
for res in face.remote_mappings.values_mut() {
get_mut_unchecked(res).session_ctxs.remove(&face.id);
Expand Down
6 changes: 6 additions & 0 deletions zenoh/src/net/routing/hat/linkstate_peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ impl HatBaseTrait for HatCode {
fn close_face(&self, tables: &TablesLock, face: &mut Arc<FaceState>) {
let mut wtables = zwrite!(tables.tables);
let mut face_clone = face.clone();

face_hat_mut!(face).remote_sub_interests.clear();
face_hat_mut!(face).local_subs.clear();
face_hat_mut!(face).remote_qabl_interests.clear();
face_hat_mut!(face).local_qabls.clear();

let face = get_mut_unchecked(face);
for res in face.remote_mappings.values_mut() {
get_mut_unchecked(res).session_ctxs.remove(&face.id);
Expand Down
6 changes: 6 additions & 0 deletions zenoh/src/net/routing/hat/p2p_peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ impl HatBaseTrait for HatCode {
fn close_face(&self, tables: &TablesLock, face: &mut Arc<FaceState>) {
let mut wtables = zwrite!(tables.tables);
let mut face_clone = face.clone();

face_hat_mut!(face).remote_sub_interests.clear();
face_hat_mut!(face).local_subs.clear();
face_hat_mut!(face).remote_qabl_interests.clear();
face_hat_mut!(face).local_qabls.clear();

let face = get_mut_unchecked(face);
for res in face.remote_mappings.values_mut() {
get_mut_unchecked(res).session_ctxs.remove(&face.id);
Expand Down
6 changes: 6 additions & 0 deletions zenoh/src/net/routing/hat/router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,12 @@ impl HatBaseTrait for HatCode {
fn close_face(&self, tables: &TablesLock, face: &mut Arc<FaceState>) {
let mut wtables = zwrite!(tables.tables);
let mut face_clone = face.clone();

face_hat_mut!(face).remote_sub_interests.clear();
face_hat_mut!(face).local_subs.clear();
face_hat_mut!(face).remote_qabl_interests.clear();
face_hat_mut!(face).local_qabls.clear();

let face = get_mut_unchecked(face);
for res in face.remote_mappings.values_mut() {
get_mut_unchecked(res).session_ctxs.remove(&face.id);
Expand Down

0 comments on commit 8cd6aee

Please sign in to comment.