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 3, 2024
1 parent 33b5ebe commit c608f18
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 @@ -120,6 +120,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 @@ -193,6 +193,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 c608f18

Please sign in to comment.