Skip to content

Memory Leak in api.c #309

@zhaohuanqdcn

Description

@zhaohuanqdcn

Hey all,

I would like to report a memory leak detected with ASAN in api.c.

The leak can be trigged an input with invalid trailing UTF-8 octet, and one such input is attached.

input.txt

To reproduce, simply run ./tests/run-parser-test-suite input.txt after building with ASAN (CFLAGS="-fsanitize=address -g -O1")

The ASAN report will look like:

Parse error: invalid trailing UTF-8 octet

=================================================================
==3391==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 50176 byte(s) in 5 object(s) allocated from:
    #0 0x7ffff7682887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55555555bc75 in yaml_malloc /libyaml-asan/src/api.c:33

SUMMARY: AddressSanitizer: 50176 byte(s) leaked in 5 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