This repository was archived by the owner on Jan 8, 2025. It is now read-only.
This repository was archived by the owner on Jan 8, 2025. It is now read-only.
Open
Description
I am seeing a memory leak with the simplest example document:
test.cpp
:
#include <mei/mei.h>
#include <mei/shared.h>
int main(){
mei::MeiDocument *doc = new mei::MeiDocument();
mei::Mei *mei = new mei::Mei();
doc->setRootElement(mei);
delete d
5D5A
oc;
}
I compile with this command:
clang++ -Wall -Werror -Wextra -Wpedantic -lmei -O1 -g -fsanitize=address -fno-omit-frame-pointer -o test test.cpp
This is the output from clang
about the memory leak:
=================================================================
==16660==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 80 byte(s) in 1 object(s) allocated from:
#0 0x4fd927 in operator new(unsigned long) (/[dir]/test+0x4fd927)
#1 0x7fd379584aa8 in mei::MeiDocument::setRootElement(mei::MeiElement*) (/usr/local/lib/libmei.so+0xf3aa8)
#2 0x50065e in main /[dir]/test.cpp:7:10
#3 0x7fd378f9e55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
Direct leak of 80 byte(s) in 1 object(s) allocated from:
#0 0x4fd927 in operator new(unsigned long) (/[dir[/test+0x4fd927)
#1 0x7fd379584b4e in mei::MeiDocument::setRootElement(mei::MeiElement*) (/usr/local/lib/libmei.so+0xf3b4e)
#2 0x50065e in main /[dir]/test.cpp:7:10
#3 0x7fd378f9e55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
Indirect leak of 37 byte(s) in 1 object(s) allocated from:
#0 0x4fd927 in operator new(unsigned long) (/[dir]/test+0x4fd927)
#1 0x7fd3793b7181 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (/lib64/libstdc++.so.6+0x145181)
SUMMARY: AddressSanitizer: 197 byte(s) leaked in 3 allocation(s).
Metadata
Metadata
Assignees
Labels
No labels