Skip to content

Memory leak in usbviewer example #7900

Open
@spacey-sooty

Description

@spacey-sooty

Describe the bug
Asan shows their is a memory leak in the usbviewer

To Reproduce
Steps to reproduce the behavior:

  1. Compile the usbviewer with asan
  2. Run it
  3. See this error
=================================================================
==142983==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 192 byte(s) in 2 object(s) allocated from:
    #0 0x779ba32fe548 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x5b62980bee25 in main::{lambda()#1}::operator()() const (/home/jadey/Documents/frc/apriltag-rubbish/build/visionrubbish+0x1de25) (BuildId: 96ebc826a9ba0f0922c6833eea01128a489bce46)

Indirect leak of 3276944 byte(s) in 2 object(s) allocated from:
    #0 0x779ba32fd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x779b9dea4700 in cv::fastMalloc(unsigned long) (/usr/local/lib/libopencv_core.so.410+0xa4700) (BuildId: d9382fc27d184e3df721422085574b208af801ea)
    #2 0x779b9dffe69c in cv::Mat::create(int, int, int) (/usr/local/lib/libopencv_core.so.410+0x1fe69c) (BuildId: d9382fc27d184e3df721422085574b208af801ea)
    #3 0x779b9ecfa895 in cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int, cv::AlgorithmHint) (/usr/local/lib/libopencv_imgproc.so.410+0xfa895) (BuildId: b89b4ce66862e380e0a62d007af387a29bd0709b)
    #4 0x5b62980bd778 in main::{lambda()#1}::operator()() const (/home/jadey/Documents/frc/apriltag-rubbish/build/visionrubbish+0x1c778) (BuildId: 96ebc826a9ba0f0922c6833eea01128a489bce46)

Indirect leak of 208 byte(s) in 2 object(s) allocated from:
    #0 0x779ba32fe548 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x779b9dffe23e in cv::Mat::create(int, int const*, int) (/usr/local/lib/libopencv_core.so.410+0x1fe23e) (BuildId: d9382fc27d184e3df721422085574b208af801ea)
    #2 0x779b9dffe69c in cv::Mat::create(int, int, int) (/usr/local/lib/libopencv_core.so.410+0x1fe69c) (BuildId: d9382fc27d184e3df721422085574b208af801ea)
    #3 0x779b9ecfa895 in cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int, cv::AlgorithmHint) (/usr/local/lib/libopencv_imgproc.so.410+0xfa895) (BuildId: b89b4ce66862e380e0a62d007af387a29bd0709b)
    #4 0x5b62980bd778 in main::{lambda()#1}::operator()() const (/home/jadey/Documents/frc/apriltag-rubbish/build/visionrubbish+0x1c778) (BuildId: 96ebc826a9ba0f0922c6833eea01128a489bce46)

SUMMARY: AddressSanitizer: 3277344 byte(s) leaked in 6 allocation(s).

Expected behavior
No memory leak

Additional context
The leak appears to be the same no matter how long the program runs for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions