mz-automation / libiec61850

Official repository for libIEC61850, the open-source library for the IEC 61850 protocols
http://libiec61850.com/libiec61850
GNU General Public License v3.0
863 stars 461 forks source link

why client_report.c will memory leak #485

Closed sdoa5335717 closed 9 months ago

sdoa5335717 commented 10 months ago

In function "iedConnection_handleReport", line 536, If report set entryId flags, MmValue_cone will cause memory leak, I find this by valgrind, this is the result:

==17333== 9,309 (2,568 direct, 6,741 indirect) bytes in 107 blocks are definitely lost in loss record 261 of 271 ==17333== at 0x4837B65: calloc (vg_replace_malloc.c:752) ==17333== by 0x2023C5: Memory_calloc (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1AAC1E: MmsValue_clone (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1B33DC: iedConnection_handleReport (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1B4258: informationReportHandler (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1BDAE2: handleUnconfirmedMmsPdu (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1BFC76: mmsIsoCallback (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1D3E77: IsoClientConnection_handleConnection (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1C0B93: MmsConnection_tick (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x1C02C0: connectionHandlingThread (in /home/sduept/projects/sdom61850proxy/bin/debug/61850deviceclient) ==17333== by 0x48CCFA2: start_thread (pthread_create.c:486) ==17333== by 0x52074CE: clone (clone.S:95)

so how to deal this problem?

mzillgith commented 10 months ago

I cannot reproduce this issue with the latest code. Maybe you are using an older version?