MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / assign22

Method assign22

test/testleakautovar.cpp:450–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448 }
449
450 void assign22() { // #9139
451 const Settings s = settingsBuilder().library("posix.cfg").checkLibrary().build();
452 check("void f(char tempFileName[256]) {\n"
453 " const int fd = socket(AF_INET, SOCK_PACKET, 0 );\n"
454 "}", dinit(CheckOptions, $.cpp = true, $.s = &s));
455 ASSERT_EQUALS("[test.cpp:3:1]: (error) Resource leak: fd [resourceLeak]\n", errout_str());
456
457 check("void f() {\n"
458 " const void * const p = malloc(10);\n"
459 "}", dinit(CheckOptions, $.cpp = true));
460 ASSERT_EQUALS("[test.cpp:3:1]: (error) Memory leak: p [memleak]\n", errout_str());
461 }
462
463 void assign23() {
464 const Settings s = settingsBuilder().library("posix.cfg").checkLibrary().build();

Callers

nothing calls this directly

Calls 3

buildMethod · 0.80
checkLibraryMethod · 0.80
libraryMethod · 0.80

Tested by

no test coverage detected