Skip to content

Memeory leak in goose_publisher_example.c #104

Open
@RootUp

Description

@RootUp

Hi team,

Their are multiple memory leaks in goose_publisher_example.c

Snip goose_publisher_example.c

	LinkedList_add(dataSetValues, MmsValue_newIntegerFromInt32(1234));
	LinkedList_add(dataSetValues, MmsValue_newBinaryTime(false));
        LinkedList_add(dataSetValues, MmsValue_newIntegerFromInt32(5678));

Memory leaks

=================================================================
==1276==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x7f98bdabdb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x55c2071bac8b in Memory_malloc /home/input0/Desktop/libiec61850/hal/memory/lib_memory.c:47
    #2 0x55c2071abca3 in Asn1PrimitiveValue_create /home/input0/Desktop/libiec61850/src/mms/asn1/asn1_ber_primitive_value.c:31
    #3 0x55c2071ac49b in BerInteger_createInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:49
    #4 0x55c2071ac8e3 in BerInteger_createFromInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:97
    #5 0x55c2071a27e1 in MmsValue_newIntegerFromInt32 /home/input0/Desktop/libiec61850/src/mms/iso_mms/common/mms_value.c:827
    #6 0x55c20719c192 in main /home/input0/Desktop/libiec61850/examples/goose_publisher/goose_publisher_example.c:30
    #7 0x7f98bd3f0b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x7f98bdabdb50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x55c2071bac8b in Memory_malloc /home/input0/Desktop/libiec61850/hal/memory/lib_memory.c:47
    #2 0x55c2071abca3 in Asn1PrimitiveValue_create /home/input0/Desktop/libiec61850/src/mms/asn1/asn1_ber_primitive_value.c:31
    #3 0x55c2071ac49b in BerInteger_createInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:49
    #4 0x55c2071ac8e3 in BerInteger_createFromInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:97
    #5 0x55c2071a27e1 in MmsValue_newIntegerFromInt32 /home/input0/Desktop/libiec61850/src/mms/iso_mms/common/mms_value.c:827
    #6 0x55c20719c1d0 in main /home/input0/Desktop/libiec61850/examples/goose_publisher/goose_publisher_example.c:32
    #7 0x7f98bd3f0b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x7f98bdabdd38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
    #1 0x55c2071bacc4 in Memory_calloc /home/input0/Desktop/libiec61850/hal/memory/lib_memory.c:59
    #2 0x55c2071abd39 in Asn1PrimitiveValue_create /home/input0/Desktop/libiec61850/src/mms/asn1/asn1_ber_primitive_value.c:35
    #3 0x55c2071ac49b in BerInteger_createInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:49
    #4 0x55c2071ac8e3 in BerInteger_createFromInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:97
    #5 0x55c2071a27e1 in MmsValue_newIntegerFromInt32 /home/input0/Desktop/libiec61850/src/mms/iso_mms/common/mms_value.c:827
    #6 0x55c20719c1d0 in main /home/input0/Desktop/libiec61850/examples/goose_publisher/goose_publisher_example.c:32
    #7 0x7f98bd3f0b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x7f98bdabdd38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
    #1 0x55c2071bacc4 in Memory_calloc /home/input0/Desktop/libiec61850/hal/memory/lib_memory.c:59
    #2 0x55c2071abd39 in Asn1PrimitiveValue_create /home/input0/Desktop/libiec61850/src/mms/asn1/asn1_ber_primitive_value.c:35
    #3 0x55c2071ac49b in BerInteger_createInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:49
    #4 0x55c2071ac8e3 in BerInteger_createFromInt32 /home/input0/Desktop/libiec61850/src/mms/asn1/ber_integer.c:97
    #5 0x55c2071a27e1 in MmsValue_newIntegerFromInt32 /home/input0/Desktop/libiec61850/src/mms/iso_mms/common/mms_value.c:827
    #6 0x55c20719c192 in main /home/input0/Desktop/libiec61850/examples/goose_publisher/goose_publisher_example.c:30
    #7 0x7f98bd3f0b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

SUMMARY: AddressSanitizer: 30 byte(s) leaked in 4 allocation(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions