Skip to content
Snippets Groups Projects
  • calrama's avatar
    26c884c5
    How about less use-after-free UB? · 26c884c5
    calrama authored
    If anyone cares why this is UB :
    1. as<std::string>() creates a temporary
    2. .c_str() returns a pointer into memory owned by the temporary
    3. the temporary's lifetime ends and it is destroyed
    4. the pointer into now freed memoroy is passed to QString()
    
    Also, don't make non-void functions without returning anything...
    26c884c5
    History
    How about less use-after-free UB?
    calrama authored
    If anyone cares why this is UB :
    1. as<std::string>() creates a temporary
    2. .c_str() returns a pointer into memory owned by the temporary
    3. the temporary's lifetime ends and it is destroyed
    4. the pointer into now freed memoroy is passed to QString()
    
    Also, don't make non-void functions without returning anything...
Code owners
Assign users and groups as approvers for specific file changes. Learn more.