Skip to content

free(): Invalid pointer when specifying bool flags on program finish #110

Description

@0sleep

I have a program parsing some required options, some optional options, and I'm trying to also check if some flags are set. From what I understand, I need to:

  • initialise a bool like bool testBool = false
  • add option to parser like | lyra::opt(testBool)["-t"]["--testbool"]("Test bool");
    After this, I can then parse argc and argv, and check for testBool being passed like if (testBool) { std::cout << "TestBool = y" << std::endl; }
    However, if I have any bools in my lyra arg parser, my program seems to work fine until my main function returns, after which I get
free(): invalid pointer
Aborted: core dumped

if I pass -t to my executable.
Does anyone else experience this issue? (There is a decent chance that this is not actually a problem with lyra itself, but maybe a problem with my c++ skills, I am very new to this lang)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    👀 In review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions