Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 4deb7ad

Browse files
taurelbourtemb
authored andcommitted
- Fix memory leak when pipe event is sent and there is no client. Fix issue #447 (#448)
- Fix memory leak when pipe event is sent and there is no client process(es) subscribed to this event
1 parent e76586e commit 4deb7ad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cppapi/server/pipe.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,12 @@ void Pipe::fire_event(DeviceImpl *dev,DevicePipeBlob *p_data,struct timeval &t,b
790790
delta_subscription = now - event_subscription;
791791

792792
if (delta_subscription >= EVENT_RESUBSCRIBE_PERIOD)
793+
{
794+
p_data->reset_insert_ctr();
795+
DevVarPipeDataEltArray *tmp_ptr = p_data->get_insert_data();
796+
delete tmp_ptr;
793797
return;
798+
}
794799

795800
//
796801
// Get the event supplier, and simply return if not created
@@ -803,6 +808,9 @@ void Pipe::fire_event(DeviceImpl *dev,DevicePipeBlob *p_data,struct timeval &t,b
803808

804809
if (event_supplier_zmq == NULL)
805810
{
811+
p_data->reset_insert_ctr();
812+
DevVarPipeDataEltArray *tmp_ptr = p_data->get_insert_data();
813+
delete tmp_ptr;
806814
return;
807815
}
808816

0 commit comments

Comments
 (0)