[{"data":1,"prerenderedAt":4209},["ShallowReactive",2],{"global-navigation":3,"page-\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem51-cpp":28,"surround-\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem51-cpp":3521,"sidebar-sei-cert-cpp-coding-standard":3528},[4,8],{"title":5,"path":6,"_path":6,"fromAppConfig":7},"Home","\u002F",true,{"title":9,"path":10,"children":11,"_path":27,"fromAppConfig":7},"Coding Standards","\u002Fcoding-standards\u002F",[12,15,18,21,24],{"title":13,"path":14},"Android Coding Standard","\u002Fandroid-secure-coding-standard\u002F",{"title":16,"path":17},"C Coding Standard","\u002Fsei-cert-c-coding-standard\u002F",{"title":19,"path":20},"C++ Coding Standard","\u002Fsei-cert-cpp-coding-standard\u002F",{"title":22,"path":23},"Java Coding Standard","\u002Fsei-cert-oracle-coding-standard-for-java\u002F",{"title":25,"path":26},"Perl Coding Standard","\u002Fsei-cert-perl-coding-standard\u002F","\u002Fcoding-standards",{"id":29,"title":30,"body":31,"description":3500,"extension":3501,"meta":3502,"navigation":7,"path":3517,"seo":3518,"stem":3519,"__hash__":3520},"content\u002F5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F3.mem51-cpp.md","MEM51-CPP. Properly deallocate dynamically allocated resources",{"type":32,"value":33,"toc":3460},"minimark",[34,38,70,96,103,249,257,265,292,299,316,329,337,360,565,571,581,723,727,744,758,763,780,979,983,1000,1222,1228,1243,1300,1306,1317,1367,1374,1382,1460,1466,1470,1490,1496,1508,1588,1593,1608,1691,1696,1701,1710,1778,1784,1812,1993,1999,2010,2173,2179,2193,2264,2269,2279,2357,2369,2375,2389,2453,2458,2471,2552,2556,2564,2625,2629,3217,3221,3232,3236,3312,3316,3432,3435,3456],[35,36,30],"h1",{"id":37},"mem51-cpp-properly-deallocate-dynamically-allocated-resources",[39,40,41,42,46,47,50,51,54,55,58,59,64,65,69],"p",{},"The C programming language provides several ways to allocate memory, such as ",[43,44,45],"code",{},"std::malloc()"," , ",[43,48,49],{},"std::calloc()"," , and ",[43,52,53],{},"std::realloc()"," , which can be used by a C++ program. However, the C programming language defines only a single way to free the allocated memory: ",[43,56,57],{},"std::free()"," . See ",[60,61,63],"a",{"href":62},"\u002Fsei-cert-c-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem31-c","MEM31-C. Free dynamically allocated memory when no longer needed"," and ",[60,66,68],{"href":67},"\u002Fsei-cert-c-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem34-c","MEM34-C. Only free memory allocated dynamically"," for rules specifically regarding C allocation and deallocation requirements.",[39,71,72,73,46,76,79,80,50,82,88,89,46,92,95],{},"The C++ programming language adds additional ways to allocate memory, such as the operators ",[43,74,75],{},"new",[43,77,78],{},"new[]"," , and placement ",[43,81,75],{},[60,83,87],{"href":84,"rel":85},"http:\u002F\u002Fwww.cplusplus.com\u002Freference\u002Fmemory\u002Fallocator\u002F",[86],"nofollow","allocator objects"," . Unlike C, C++ provides multiple ways to free dynamically allocated memory, such as the operators ",[43,90,91],{},"delete",[43,93,94],{},"delete[]()"," , and deallocation functions on allocator objects.",[39,97,98,99,102],{},"Do not call a deallocation function on anything other than ",[43,100,101],{},"nullptr"," , or a pointer returned by the corresponding allocation function described by the following.",[104,105,108],"table",{"className":106},[107],"wrapped",[109,110,111,123,143,157,172,185,198,213,236],"tbody",{},[112,113,116,120],"tr",{"className":114},[115],"header",[117,118,119],"th",{},"Allocator",[117,121,122],{},"Deallocator",[112,124,127,134],{"className":125},[126],"odd",[128,129,130,131],"td",{},"global ",[43,132,133],{},"      operator new()\u002Fnew     ",[128,135,130,136,139,140],{},[43,137,138],{},"      operator delete     "," () ",[43,141,142],{},"      \u002Fdelete     ",[112,144,147,152],{"className":145},[146],"even",[128,148,130,149],{},[43,150,151],{},"      operator new[]()\u002Fnew[]     ",[128,153,130,154],{},[43,155,156],{},"      operator delete[]()\u002Fdelete[]     ",[112,158,160,165],{"className":159},[126],[128,161,162,163],{},"class-specific ",[43,164,133],{},[128,166,167,139,170],{},[43,168,169],{},"      class-specific      operator delete     ",[43,171,142],{},[112,173,175,180],{"className":174},[146],[128,176,177],{},[43,178,179],{},"      class-specific      operator new[]()\u002Fnew[]     ",[128,181,182],{},[43,183,184],{},"      class-specific      operator delete[]()\u002Fdelete[]     ",[112,186,188,195],{"className":187},[126],[128,189,190,191,194],{},"placement ",[43,192,193],{},"      operator new     "," ()",[128,196,197],{},"N\u002FA",[112,199,201,206],{"className":200},[146],[128,202,203],{},[43,204,205],{},"      allocator\u003CT>::allocate()     ",[128,207,208],{},[39,209,210],{},[43,211,212],{},"       allocator\u003CT>::deallocate()      ",[112,214,216,231],{"className":215},[126],[128,217,218,46,221,224,225,228],{},[43,219,220],{},"      std::malloc()     ",[43,222,223],{},"      std::calloc()     "," ,",[226,227],"br",{},[43,229,230],{},"      std::      realloc()     ",[128,232,233],{},[43,234,235],{},"      std::      free()     ",[112,237,239,244],{"className":238},[146],[128,240,241],{},[43,242,243],{},"      std::get_temporary_buffer()     ",[128,245,246],{},[43,247,248],{},"      std::return_temporary_buffer()     ",[39,250,251,252,256],{},"Passing a pointer value to an inappropriate deallocation function can result in ",[60,253,255],{"href":254},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fbb-definitions#BB.Definitions-undefinedbehavior","undefined behavior"," .",[39,258,259,260,264],{},"The C++ Standard, [expr.delete], paragraph 2 [ ",[60,261,263],{"href":262},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Faa-bibliography#AA.Bibliography-ISO\u002FIEC14882-2014","ISO\u002FIEC 14882-2014"," ], in part, states the following:",[266,267,268],"blockquote",{},[39,269,270,271,275,276,278,279,282,283,275,286,288,289,291],{},"In the first alternative ( ",[272,273,274],"em",{},"delete object"," ), the value of the operand of ",[43,277,91],{}," may be a null pointer value, a pointer to a non-array object created by a previous ",[272,280,281],{},"new-expression"," , or a pointer to a subobject (1.8) representing a base class of such an object (Clause 10). If not, the behavior is undefined. In the second alternative ( ",[272,284,285],{},"delete array",[43,287,91],{}," may be a null pointer value or a pointer value that resulted from a previous array ",[272,290,281],{}," . If not, the behavior is undefined.",[39,293,294,295,298],{},"Deallocating a pointer that is not allocated dynamically (including non-dynamic pointers returned from calls to placement ",[43,296,297],{},"new()"," ) is undefined behavior because the pointer value was not obtained by an allocation function. Deallocating a pointer that has already been passed to a deallocation function is undefined behavior because the pointer value no longer points to memory that has been dynamically allocated.",[39,300,301,302,304,305,308,309,312,313,315],{},"When an operator such as ",[43,303,75],{}," is called, it results in a call to an overloadable operator of the same name, such as ",[43,306,307],{},"  operator new() "," . These overloadable functions can be called directly but carry the same restrictions as their operator counterparts. That is, calling ",[43,310,311],{},"  operator delete() "," and passing a pointer parameter has the same constraints as calling the ",[43,314,91],{}," operator on that pointer. Further, the overloads are subject to scope resolution, so it is possible (but not permissible) to call a class-specific operator to allocate an object but a global operator to deallocate the object.",[39,317,318,319,323,324,64,326,328],{},"See ",[60,320,322],{"href":321},"\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem53-cpp","MEM53-CPP. Explicitly construct and destruct objects when manually managing object lifetime"," for information on lifetime management of objects when using memory management functions other than the ",[43,325,75],{},[43,327,91],{}," operators.",[330,331,333,334,336],"h2",{"id":332},"noncompliant-code-example-placement-new","Noncompliant Code Example (placement ",[43,335,297],{}," )",[39,338,339,340,343,344,346,347,350,351,353,354,356,357,256],{},"In this noncompliant code example, the local variable ",[43,341,342],{},"space"," is passed as the expression to the placement ",[43,345,75],{}," operator. The resulting pointer of that call is then passed to ",[43,348,349],{},"  ::operator delete() "," , resulting in ",[60,352,255],{"href":254}," due to ",[43,355,349],{}," attempting to free memory that was not returned by ",[43,358,359],{},"  ::operator new() ",[361,362,364],"code-block",{"quality":363},"bad",[365,366,371],"pre",{"className":367,"code":368,"language":369,"meta":370,"style":370},"language-cpp shiki shiki-themes github-light github-dark monokai","#include \u003Ciostream>\n \nstruct S {\n  S() { std::cout \u003C\u003C \"S::S()\" \u003C\u003C std::endl; }\n  ~S() { std::cout \u003C\u003C \"S::~S()\" \u003C\u003C std::endl; }\n};\n\nvoid f() {\n  alignas(struct S) char space[sizeof(struct S)];\n  S *s1 = new (&space) S;\n\n  \u002F\u002F ...\n\n  delete s1;\n}\n","cpp","",[43,372,373,386,393,407,438,461,467,473,485,506,533,538,545,550,559],{"__ignoreMap":370},[374,375,378,382],"span",{"class":376,"line":377},"line",1,[374,379,381],{"class":380},"sC2Qs","#include",[374,383,385],{"class":384},"sstjo"," \u003Ciostream>\n",[374,387,389],{"class":376,"line":388},2,[374,390,392],{"class":391},"sMOD_"," \n",[374,394,396,400,404],{"class":376,"line":395},3,[374,397,399],{"class":398},"sq6CD","struct",[374,401,403],{"class":402},"sz2Vg"," S",[374,405,406],{"class":391}," {\n",[374,408,410,414,417,420,423,426,429,432,435],{"class":376,"line":409},4,[374,411,413],{"class":412},"srTi1","  S",[374,415,416],{"class":391},"() { ",[374,418,419],{"class":402},"std",[374,421,422],{"class":391},"::cout ",[374,424,425],{"class":380},"\u003C\u003C",[374,427,428],{"class":384}," \"S::S()\"",[374,430,431],{"class":380}," \u003C\u003C",[374,433,434],{"class":402}," std",[374,436,437],{"class":391},"::endl; }\n",[374,439,441,444,446,448,450,452,455,457,459],{"class":376,"line":440},5,[374,442,443],{"class":412},"  ~S",[374,445,416],{"class":391},[374,447,419],{"class":402},[374,449,422],{"class":391},[374,451,425],{"class":380},[374,453,454],{"class":384}," \"S::~S()\"",[374,456,431],{"class":380},[374,458,434],{"class":402},[374,460,437],{"class":391},[374,462,464],{"class":376,"line":463},6,[374,465,466],{"class":391},"};\n",[374,468,470],{"class":376,"line":469},7,[374,471,472],{"emptyLinePlaceholder":7},"\n",[374,474,476,479,482],{"class":376,"line":475},8,[374,477,478],{"class":398},"void",[374,480,481],{"class":412}," f",[374,483,484],{"class":391},"() {\n",[374,486,488,491,494,497,500,503],{"class":376,"line":487},9,[374,489,490],{"class":380},"  alignas",[374,492,493],{"class":391},"(struct S) ",[374,495,496],{"class":398},"char",[374,498,499],{"class":391}," space[",[374,501,502],{"class":380},"sizeof",[374,504,505],{"class":391},"(struct S)];\n",[374,507,509,512,515,518,521,524,527,530],{"class":376,"line":508},10,[374,510,511],{"class":391},"  S ",[374,513,514],{"class":380},"*",[374,516,517],{"class":391},"s1 ",[374,519,520],{"class":380},"=",[374,522,523],{"class":380}," new",[374,525,526],{"class":391}," (",[374,528,529],{"class":380},"&",[374,531,532],{"class":391},"space) S;\n",[374,534,536],{"class":376,"line":535},11,[374,537,472],{"emptyLinePlaceholder":7},[374,539,541],{"class":376,"line":540},12,[374,542,544],{"class":543},"s8-w5","  \u002F\u002F ...\n",[374,546,548],{"class":376,"line":547},13,[374,549,472],{"emptyLinePlaceholder":7},[374,551,553,556],{"class":376,"line":552},14,[374,554,555],{"class":380},"  delete",[374,557,558],{"class":391}," s1;\n",[374,560,562],{"class":376,"line":561},15,[374,563,564],{"class":391},"}\n",[330,566,568,569,336],{"id":567},"compliant-solution-placement-new","Compliant Solution (placement ",[43,570,297],{},[39,572,573,574,576,577,580],{},"This compliant solution removes the call to ",[43,575,349],{}," , instead explicitly calling ",[43,578,579],{},"s1"," 's destructor. This is one of the few times when explicitly invoking a destructor is warranted.",[361,582,584],{"quality":583},"good",[365,585,587],{"className":367,"code":586,"language":369,"meta":370,"style":370},"#include \u003Ciostream>\n \nstruct S {\n  S() { std::cout \u003C\u003C \"S::S()\" \u003C\u003C std::endl; }\n  ~S() { std::cout \u003C\u003C \"S::~S()\" \u003C\u003C std::endl; }\n};\n \nvoid f() {\n  alignas(struct S) char space[sizeof(struct S)];\n  S *s1 = new (&space) S;\n \n  \u002F\u002F ...\n\n  s1->~S();\n}\n",[43,588,589,595,600,608,628,648,652,656,664,678,696,700,704,708,719],{"__ignoreMap":370},[374,590,591,593],{"class":376,"line":377},[374,592,381],{"class":380},[374,594,385],{"class":384},[374,596,597],{"class":376,"line":388},[374,598,599],{"class":391}," \n",[374,601,602,604,606],{"class":376,"line":395},[374,603,399],{"class":398},[374,605,403],{"class":402},[374,607,406],{"class":391},[374,609,610,612,614,616,618,620,622,624,626],{"class":376,"line":409},[374,611,413],{"class":412},[374,613,416],{"class":391},[374,615,419],{"class":402},[374,617,422],{"class":391},[374,619,425],{"class":380},[374,621,428],{"class":384},[374,623,431],{"class":380},[374,625,434],{"class":402},[374,627,437],{"class":391},[374,629,630,632,634,636,638,640,642,644,646],{"class":376,"line":440},[374,631,443],{"class":412},[374,633,416],{"class":391},[374,635,419],{"class":402},[374,637,422],{"class":391},[374,639,425],{"class":380},[374,641,454],{"class":384},[374,643,431],{"class":380},[374,645,434],{"class":402},[374,647,437],{"class":391},[374,649,650],{"class":376,"line":463},[374,651,466],{"class":391},[374,653,654],{"class":376,"line":469},[374,655,599],{"class":391},[374,657,658,660,662],{"class":376,"line":475},[374,659,478],{"class":398},[374,661,481],{"class":412},[374,663,484],{"class":391},[374,665,666,668,670,672,674,676],{"class":376,"line":487},[374,667,490],{"class":380},[374,669,493],{"class":391},[374,671,496],{"class":398},[374,673,499],{"class":391},[374,675,502],{"class":380},[374,677,505],{"class":391},[374,679,680,682,684,686,688,690,692,694],{"class":376,"line":508},[374,681,511],{"class":391},[374,683,514],{"class":380},[374,685,517],{"class":391},[374,687,520],{"class":380},[374,689,523],{"class":380},[374,691,526],{"class":391},[374,693,529],{"class":380},[374,695,532],{"class":391},[374,697,698],{"class":376,"line":535},[374,699,599],{"class":391},[374,701,702],{"class":376,"line":540},[374,703,544],{"class":543},[374,705,706],{"class":376,"line":547},[374,707,472],{"emptyLinePlaceholder":7},[374,709,710,713,716],{"class":376,"line":552},[374,711,712],{"class":391},"  s1->",[374,714,715],{"class":412},"~S",[374,717,718],{"class":391},"();\n",[374,720,721],{"class":376,"line":561},[374,722,564],{"class":391},[330,724,726],{"id":725},"noncompliant-code-example-double-free","Noncompliant Code Example (Double-Free)",[39,728,729,730,734,735,738,739,743],{},"Once a pointer is passed to the proper deallocation function, that pointer value is invalidated. Passing the pointer to a deallocation function a second time when the pointer value has not been returned by a subsequent call to an allocation function results in an attempt to free memory that has not been allocated dynamically. The underlying data structures that manage the heap can become corrupted in a way that can introduce security ",[60,731,733],{"href":732},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fbb-definitions#BB.Definitions-vulnerability","vulnerabilities"," into a program. These types of issues are called ",[272,736,737],{},"double-free vulnerabilities"," . In practice, double-free vulnerabilities can be ",[60,740,742],{"href":741},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fbb-definitions#BB.Definitions-exploit","exploited"," to execute arbitrary code.",[39,745,746,747,750,751,754,755,757],{},"In this noncompliant code example, the class ",[43,748,749],{},"C"," is given ownership of a ",[43,752,753],{},"  P * "," , which is subsequently deleted by the class destructor. The C++ Standard, [class.copy], paragraph 7 [ ",[60,756,263],{"href":262}," ], states the following:",[266,759,760],{},[39,761,762],{},"If the class definition does not explicitly declare a copy constructor, one is declared implicitly. If the class definition declares a move constructor or move assignment operator, the implicitly declared copy constructor is defined as deleted; otherwise, it is defined as defaulted (8.4). The latter case is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor.",[39,764,765,766,768,769,771,772,775,776,779],{},"Despite the presence of a user-declared destructor, ",[43,767,749],{}," will have an implicitly defaulted copy constructor defined for it, and this defaulted copy constructor will copy the pointer value stored in ",[43,770,39],{}," , resulting in a double-free: the first free happens when ",[43,773,774],{},"g()"," exits and the second free happens when ",[43,777,778],{},"h()"," exits.",[361,781,782],{"quality":363},[365,783,785],{"className":367,"code":784,"language":369,"meta":370,"style":370},"struct P {};\n\nclass C {\n  P *p;\n  \npublic:\n  C(P *p) : p(p) {}\n  ~C() { delete p; }  \n  \n  void f() {}\n};\n\nvoid g(C c) {\n  c.f();\n}\n\nvoid h() {\n  P *p = new P;\n  C c(p);\n  g(c);\n}\n",[43,786,787,797,801,811,821,826,831,856,868,872,882,886,890,907,917,921,926,936,953,965,974],{"__ignoreMap":370},[374,788,789,791,794],{"class":376,"line":377},[374,790,399],{"class":398},[374,792,793],{"class":402}," P",[374,795,796],{"class":391}," {};\n",[374,798,799],{"class":376,"line":388},[374,800,472],{"emptyLinePlaceholder":7},[374,802,803,806,809],{"class":376,"line":395},[374,804,805],{"class":398},"class",[374,807,808],{"class":402}," C",[374,810,406],{"class":391},[374,812,813,816,818],{"class":376,"line":409},[374,814,815],{"class":391},"  P ",[374,817,514],{"class":380},[374,819,820],{"class":391},"p;\n",[374,822,823],{"class":376,"line":440},[374,824,825],{"class":391},"  \n",[374,827,828],{"class":376,"line":463},[374,829,830],{"class":398},"public:\n",[374,832,833,836,839,842,845,848,851,853],{"class":376,"line":469},[374,834,835],{"class":412},"  C",[374,837,838],{"class":391},"(",[374,840,841],{"class":402},"P",[374,843,844],{"class":380}," *",[374,846,39],{"class":847},"sTHNf",[374,849,850],{"class":391},") : ",[374,852,39],{"class":412},[374,854,855],{"class":391},"(p) {}\n",[374,857,858,861,863,865],{"class":376,"line":475},[374,859,860],{"class":412},"  ~C",[374,862,416],{"class":391},[374,864,91],{"class":380},[374,866,867],{"class":391}," p; }  \n",[374,869,870],{"class":376,"line":487},[374,871,825],{"class":391},[374,873,874,877,879],{"class":376,"line":508},[374,875,876],{"class":398},"  void",[374,878,481],{"class":412},[374,880,881],{"class":391},"() {}\n",[374,883,884],{"class":376,"line":535},[374,885,466],{"class":391},[374,887,888],{"class":376,"line":540},[374,889,472],{"emptyLinePlaceholder":7},[374,891,892,894,897,899,901,904],{"class":376,"line":547},[374,893,478],{"class":398},[374,895,896],{"class":412}," g",[374,898,838],{"class":391},[374,900,749],{"class":402},[374,902,903],{"class":847}," c",[374,905,906],{"class":391},") {\n",[374,908,909,912,915],{"class":376,"line":552},[374,910,911],{"class":391},"  c.",[374,913,914],{"class":412},"f",[374,916,718],{"class":391},[374,918,919],{"class":376,"line":561},[374,920,564],{"class":391},[374,922,924],{"class":376,"line":923},16,[374,925,472],{"emptyLinePlaceholder":7},[374,927,929,931,934],{"class":376,"line":928},17,[374,930,478],{"class":398},[374,932,933],{"class":412}," h",[374,935,484],{"class":391},[374,937,939,941,943,946,948,950],{"class":376,"line":938},18,[374,940,815],{"class":391},[374,942,514],{"class":380},[374,944,945],{"class":391},"p ",[374,947,520],{"class":380},[374,949,523],{"class":380},[374,951,952],{"class":391}," P;\n",[374,954,956,959,962],{"class":376,"line":955},19,[374,957,958],{"class":391},"  C ",[374,960,961],{"class":412},"c",[374,963,964],{"class":391},"(p);\n",[374,966,968,971],{"class":376,"line":967},20,[374,969,970],{"class":412},"  g",[374,972,973],{"class":391},"(c);\n",[374,975,977],{"class":376,"line":976},21,[374,978,564],{"class":391},[330,980,982],{"id":981},"compliant-solution-double-free","Compliant Solution (Double-Free)",[39,984,985,986,988,989,993,994,996,997,999],{},"In this compliant solution, the copy constructor and copy assignment operator for ",[43,987,749],{}," are explicitly deleted. This deletion would result in an ",[60,990,992],{"href":991},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fbb-definitions#BB.Definitions-ill-formed","ill-formed"," program with the definition of ",[43,995,774],{}," from the preceding noncompliant code example due to use of the deleted copy constructor. Consequently, ",[43,998,774],{}," was modified to accept its parameter by reference, removing the double-free.",[361,1001,1002],{"quality":583},[365,1003,1005],{"className":367,"code":1004,"language":369,"meta":370,"style":370},"struct P {};\n\nclass C {\n  P *p;\n  \npublic:\n  C(P *p) : p(p) {}\n  C(const C&) = delete;\n  ~C() { delete p; }\n \n  void operator=(const C&) = delete;\n  \n  void f() {}\n};\n\nvoid g(C &c) {\n  c.f();\n}\n\nvoid h() {\n  P *p = new P;\n  C c(p);\n  g(c);\n}\n",[43,1006,1007,1015,1019,1027,1035,1039,1043,1061,1085,1096,1100,1126,1130,1138,1142,1146,1163,1171,1175,1179,1187,1201,1210,1217],{"__ignoreMap":370},[374,1008,1009,1011,1013],{"class":376,"line":377},[374,1010,399],{"class":398},[374,1012,793],{"class":402},[374,1014,796],{"class":391},[374,1016,1017],{"class":376,"line":388},[374,1018,472],{"emptyLinePlaceholder":7},[374,1020,1021,1023,1025],{"class":376,"line":395},[374,1022,805],{"class":398},[374,1024,808],{"class":402},[374,1026,406],{"class":391},[374,1028,1029,1031,1033],{"class":376,"line":409},[374,1030,815],{"class":391},[374,1032,514],{"class":380},[374,1034,820],{"class":391},[374,1036,1037],{"class":376,"line":440},[374,1038,825],{"class":391},[374,1040,1041],{"class":376,"line":463},[374,1042,830],{"class":398},[374,1044,1045,1047,1049,1051,1053,1055,1057,1059],{"class":376,"line":469},[374,1046,835],{"class":412},[374,1048,838],{"class":391},[374,1050,841],{"class":402},[374,1052,844],{"class":380},[374,1054,39],{"class":847},[374,1056,850],{"class":391},[374,1058,39],{"class":412},[374,1060,855],{"class":391},[374,1062,1063,1065,1067,1070,1072,1074,1077,1079,1082],{"class":376,"line":475},[374,1064,835],{"class":412},[374,1066,838],{"class":391},[374,1068,1069],{"class":380},"const",[374,1071,808],{"class":402},[374,1073,529],{"class":380},[374,1075,1076],{"class":391},") ",[374,1078,520],{"class":380},[374,1080,1081],{"class":380}," delete",[374,1083,1084],{"class":391},";\n",[374,1086,1087,1089,1091,1093],{"class":376,"line":487},[374,1088,860],{"class":412},[374,1090,416],{"class":391},[374,1092,91],{"class":380},[374,1094,1095],{"class":391}," p; }\n",[374,1097,1098],{"class":376,"line":508},[374,1099,392],{"class":391},[374,1101,1102,1104,1107,1110,1112,1114,1116,1118,1120,1122,1124],{"class":376,"line":535},[374,1103,876],{"class":398},[374,1105,1106],{"class":380}," operator",[374,1108,520],{"class":1109},"s_OQ2",[374,1111,838],{"class":391},[374,1113,1069],{"class":380},[374,1115,808],{"class":402},[374,1117,529],{"class":380},[374,1119,1076],{"class":391},[374,1121,520],{"class":380},[374,1123,1081],{"class":380},[374,1125,1084],{"class":391},[374,1127,1128],{"class":376,"line":540},[374,1129,825],{"class":391},[374,1131,1132,1134,1136],{"class":376,"line":547},[374,1133,876],{"class":398},[374,1135,481],{"class":412},[374,1137,881],{"class":391},[374,1139,1140],{"class":376,"line":552},[374,1141,466],{"class":391},[374,1143,1144],{"class":376,"line":561},[374,1145,472],{"emptyLinePlaceholder":7},[374,1147,1148,1150,1152,1154,1156,1159,1161],{"class":376,"line":923},[374,1149,478],{"class":398},[374,1151,896],{"class":412},[374,1153,838],{"class":391},[374,1155,749],{"class":402},[374,1157,1158],{"class":380}," &",[374,1160,961],{"class":847},[374,1162,906],{"class":391},[374,1164,1165,1167,1169],{"class":376,"line":928},[374,1166,911],{"class":391},[374,1168,914],{"class":412},[374,1170,718],{"class":391},[374,1172,1173],{"class":376,"line":938},[374,1174,564],{"class":391},[374,1176,1177],{"class":376,"line":955},[374,1178,472],{"emptyLinePlaceholder":7},[374,1180,1181,1183,1185],{"class":376,"line":967},[374,1182,478],{"class":398},[374,1184,933],{"class":412},[374,1186,484],{"class":391},[374,1188,1189,1191,1193,1195,1197,1199],{"class":376,"line":976},[374,1190,815],{"class":391},[374,1192,514],{"class":380},[374,1194,945],{"class":391},[374,1196,520],{"class":380},[374,1198,523],{"class":380},[374,1200,952],{"class":391},[374,1202,1204,1206,1208],{"class":376,"line":1203},22,[374,1205,958],{"class":391},[374,1207,961],{"class":412},[374,1209,964],{"class":391},[374,1211,1213,1215],{"class":376,"line":1212},23,[374,1214,970],{"class":412},[374,1216,973],{"class":391},[374,1218,1220],{"class":376,"line":1219},24,[374,1221,564],{"class":391},[330,1223,1225,1226,336],{"id":1224},"noncompliant-code-examplearray-new","Noncompliant Code Example (array ",[43,1227,78],{},[39,1229,1230,1231,1233,1234,1236,1237,1240,1241,256],{},"In the following noncompliant code example, an array is allocated with array ",[43,1232,78],{}," but is deallocated with a scalar ",[43,1235,91],{}," call instead of an array ",[43,1238,1239],{},"delete[]"," call, resulting in ",[60,1242,255],{"href":254},[361,1244,1245],{"quality":363},[365,1246,1248],{"className":367,"code":1247,"language":369,"meta":370,"style":370},"void f() {\n  int *array = new int[10];\n  \u002F\u002F ...\n  delete array;\n}\n",[43,1249,1250,1258,1285,1289,1296],{"__ignoreMap":370},[374,1251,1252,1254,1256],{"class":376,"line":377},[374,1253,478],{"class":398},[374,1255,481],{"class":412},[374,1257,484],{"class":391},[374,1259,1260,1263,1265,1268,1270,1272,1275,1278,1282],{"class":376,"line":388},[374,1261,1262],{"class":398},"  int",[374,1264,844],{"class":380},[374,1266,1267],{"class":391},"array ",[374,1269,520],{"class":380},[374,1271,523],{"class":380},[374,1273,1274],{"class":398}," int",[374,1276,1277],{"class":391},"[",[374,1279,1281],{"class":1280},"s7F3e","10",[374,1283,1284],{"class":391},"];\n",[374,1286,1287],{"class":376,"line":395},[374,1288,544],{"class":543},[374,1290,1291,1293],{"class":376,"line":409},[374,1292,555],{"class":380},[374,1294,1295],{"class":391}," array;\n",[374,1297,1298],{"class":376,"line":440},[374,1299,564],{"class":391},[330,1301,1303,1304,336],{"id":1302},"compliant-solution-array-new","Compliant Solution ( array ",[43,1305,78],{},[330,1307,1309,1310,1312,1313,1316],{"id":1308},"in-the-compliant-solution-the-code-is-fixed-by-replacing-the-call-to-delete-with-a-call-to-delete-to-adhere-to-the-correct-pairing-of-memory-allocation-and-deallocation-functions","In the compliant solution, the code is fixed by replacing the call to ",[43,1311,91],{}," with a call to ",[43,1314,1315],{},"  delete [] "," to adhere to the correct pairing of memory allocation and deallocation functions.",[361,1318,1319],{"quality":583},[365,1320,1322],{"className":367,"code":1321,"language":369,"meta":370,"style":370},"void f() {\n  int *array = new int[10];\n  \u002F\u002F ...\n  delete[] array;\n}\n",[43,1323,1324,1332,1352,1356,1363],{"__ignoreMap":370},[374,1325,1326,1328,1330],{"class":376,"line":377},[374,1327,478],{"class":398},[374,1329,481],{"class":412},[374,1331,484],{"class":391},[374,1333,1334,1336,1338,1340,1342,1344,1346,1348,1350],{"class":376,"line":388},[374,1335,1262],{"class":398},[374,1337,844],{"class":380},[374,1339,1267],{"class":391},[374,1341,520],{"class":380},[374,1343,523],{"class":380},[374,1345,1274],{"class":398},[374,1347,1277],{"class":391},[374,1349,1281],{"class":1280},[374,1351,1284],{"class":391},[374,1353,1354],{"class":376,"line":395},[374,1355,544],{"class":543},[374,1357,1358,1361],{"class":376,"line":409},[374,1359,1360],{"class":380},"  delete[]",[374,1362,1295],{"class":391},[374,1364,1365],{"class":376,"line":440},[374,1366,564],{"class":391},[330,1368,1370,1371,336],{"id":1369},"noncompliant-code-example-malloc","Noncompliant Code Example ( ",[43,1372,1373],{},"malloc()",[39,1375,1376,1377,1379,1380,256],{},"In this noncompliant code example, the call to ",[43,1378,1373],{}," is mixed with a call to ",[43,1381,91],{},[361,1383,1384],{"quality":363},[365,1385,1387],{"className":367,"code":1386,"language":369,"meta":370,"style":370},"#include \u003Ccstdlib>\nvoid f() {\n  int *i = static_cast\u003Cint *>(std::malloc(sizeof(int)));\n  \u002F\u002F ...\n  delete i;\n}\n",[43,1388,1389,1396,1404,1445,1449,1456],{"__ignoreMap":370},[374,1390,1391,1393],{"class":376,"line":377},[374,1392,381],{"class":380},[374,1394,1395],{"class":384}," \u003Ccstdlib>\n",[374,1397,1398,1400,1402],{"class":376,"line":388},[374,1399,478],{"class":398},[374,1401,481],{"class":412},[374,1403,484],{"class":391},[374,1405,1406,1408,1410,1413,1415,1418,1421,1424,1426,1428,1431,1434,1436,1438,1440,1442],{"class":376,"line":395},[374,1407,1262],{"class":398},[374,1409,844],{"class":380},[374,1411,1412],{"class":391},"i ",[374,1414,520],{"class":380},[374,1416,1417],{"class":380}," static_cast\u003C",[374,1419,1420],{"class":398},"int",[374,1422,1423],{"class":380}," *>",[374,1425,838],{"class":391},[374,1427,419],{"class":402},[374,1429,1430],{"class":391},"::",[374,1432,1433],{"class":412},"malloc",[374,1435,838],{"class":391},[374,1437,502],{"class":380},[374,1439,838],{"class":391},[374,1441,1420],{"class":398},[374,1443,1444],{"class":391},")));\n",[374,1446,1447],{"class":376,"line":409},[374,1448,544],{"class":543},[374,1450,1451,1453],{"class":376,"line":440},[374,1452,555],{"class":380},[374,1454,1455],{"class":391}," i;\n",[374,1457,1458],{"class":376,"line":463},[374,1459,564],{"class":391},[39,1461,1462,1463,1465],{},"This code does not violate ",[60,1464,322],{"href":321}," because it complies with the MEM53-CPP-EX1 exception.",[330,1467,1469],{"id":1468},"implementation-details","Implementation Details",[39,1471,1472,1473,1475,1476,1478,1479,1481,1482,1484,1485,1489],{},"Some implementations of ",[43,1474,359],{}," result in calling ",[43,1477,45],{}," . On such implementations, the ",[43,1480,349],{}," function is required to call ",[43,1483,57],{}," to deallocate the pointer, and the noncompliant code example would behave in a well-defined manner. However, this is an ",[60,1486,1488],{"href":1487},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fbb-definitions#BB.Definitions-implementation","implementation"," detail and should not be relied on—implementations are under no obligation to use underlying C memory management functions to implement C++ memory management operators.",[330,1491,1493,1494,336],{"id":1492},"compliant-solution-malloc","Compliant Solution ( ",[43,1495,1373],{},[39,1497,1498,1499,1501,1502,1504,1505],{},"In this compliant solution, the pointer allocated by ",[43,1500,45],{}," is deallocated by a call to ",[43,1503,57],{}," instead of ",[43,1506,1507],{},"delete.",[361,1509,1510],{"quality":583},[365,1511,1513],{"className":367,"code":1512,"language":369,"meta":370,"style":370},"#include \u003Ccstdlib>\n\nvoid f() {\n  int *i = static_cast\u003Cint *>(std::malloc(sizeof(int)));\n  \u002F\u002F ...\n  std::free(i);\n}\n",[43,1514,1515,1521,1525,1533,1567,1571,1584],{"__ignoreMap":370},[374,1516,1517,1519],{"class":376,"line":377},[374,1518,381],{"class":380},[374,1520,1395],{"class":384},[374,1522,1523],{"class":376,"line":388},[374,1524,472],{"emptyLinePlaceholder":7},[374,1526,1527,1529,1531],{"class":376,"line":395},[374,1528,478],{"class":398},[374,1530,481],{"class":412},[374,1532,484],{"class":391},[374,1534,1535,1537,1539,1541,1543,1545,1547,1549,1551,1553,1555,1557,1559,1561,1563,1565],{"class":376,"line":409},[374,1536,1262],{"class":398},[374,1538,844],{"class":380},[374,1540,1412],{"class":391},[374,1542,520],{"class":380},[374,1544,1417],{"class":380},[374,1546,1420],{"class":398},[374,1548,1423],{"class":380},[374,1550,838],{"class":391},[374,1552,419],{"class":402},[374,1554,1430],{"class":391},[374,1556,1433],{"class":412},[374,1558,838],{"class":391},[374,1560,502],{"class":380},[374,1562,838],{"class":391},[374,1564,1420],{"class":398},[374,1566,1444],{"class":391},[374,1568,1569],{"class":376,"line":440},[374,1570,544],{"class":543},[374,1572,1573,1576,1578,1581],{"class":376,"line":463},[374,1574,1575],{"class":402},"  std",[374,1577,1430],{"class":391},[374,1579,1580],{"class":412},"free",[374,1582,1583],{"class":391},"(i);\n",[374,1585,1586],{"class":376,"line":469},[374,1587,564],{"class":391},[330,1589,1370,1591,336],{"id":1590},"noncompliant-code-example-new",[43,1592,75],{},[39,1594,1595,1596,1598,1599,1601,1602,1604,1605],{},"In this noncompliant code example, ",[43,1597,57],{}," is called to deallocate memory that was allocated by ",[43,1600,75],{}," . A common side effect of the ",[60,1603,255],{"href":254}," caused by using the incorrect deallocation function is that destructors will not be called for the object being deallocated by ",[43,1606,1607],{},"std::free().",[361,1609,1610],{"quality":363},[365,1611,1613],{"className":367,"code":1612,"language":369,"meta":370,"style":370},"#include \u003Ccstdlib>\n \nstruct S {\n  ~S();\n};\n\nvoid f() {\n  S *s = new S();\n  \u002F\u002F ...\n  std::free(s);\n}\n",[43,1614,1615,1621,1625,1633,1639,1643,1647,1655,1672,1676,1687],{"__ignoreMap":370},[374,1616,1617,1619],{"class":376,"line":377},[374,1618,381],{"class":380},[374,1620,1395],{"class":384},[374,1622,1623],{"class":376,"line":388},[374,1624,392],{"class":391},[374,1626,1627,1629,1631],{"class":376,"line":395},[374,1628,399],{"class":398},[374,1630,403],{"class":402},[374,1632,406],{"class":391},[374,1634,1635,1637],{"class":376,"line":409},[374,1636,443],{"class":412},[374,1638,718],{"class":391},[374,1640,1641],{"class":376,"line":440},[374,1642,466],{"class":391},[374,1644,1645],{"class":376,"line":463},[374,1646,472],{"emptyLinePlaceholder":7},[374,1648,1649,1651,1653],{"class":376,"line":469},[374,1650,478],{"class":398},[374,1652,481],{"class":412},[374,1654,484],{"class":391},[374,1656,1657,1659,1661,1664,1666,1668,1670],{"class":376,"line":475},[374,1658,511],{"class":391},[374,1660,514],{"class":380},[374,1662,1663],{"class":391},"s ",[374,1665,520],{"class":380},[374,1667,523],{"class":380},[374,1669,403],{"class":412},[374,1671,718],{"class":391},[374,1673,1674],{"class":376,"line":487},[374,1675,544],{"class":543},[374,1677,1678,1680,1682,1684],{"class":376,"line":508},[374,1679,1575],{"class":402},[374,1681,1430],{"class":391},[374,1683,1580],{"class":412},[374,1685,1686],{"class":391},"(s);\n",[374,1688,1689],{"class":376,"line":535},[374,1690,564],{"class":391},[39,1692,1693,1694,256],{},"Additionally, this code violates ",[60,1695,322],{"href":321},[330,1697,1493,1699,336],{"id":1698},"compliant-solution-new",[43,1700,75],{},[39,1702,1498,1703,1705,1706,1504,1708],{},[43,1704,75],{}," is deallocated by calling ",[43,1707,91],{},[43,1709,1607],{},[361,1711,1712],{"quality":583},[365,1713,1715],{"className":367,"code":1714,"language":369,"meta":370,"style":370},"struct S {\n  ~S();\n};\n\nvoid f() {\n  S *s = new S();\n  \u002F\u002F ...\n  delete s;\n}\n",[43,1716,1717,1725,1731,1735,1739,1747,1763,1767,1774],{"__ignoreMap":370},[374,1718,1719,1721,1723],{"class":376,"line":377},[374,1720,399],{"class":398},[374,1722,403],{"class":402},[374,1724,406],{"class":391},[374,1726,1727,1729],{"class":376,"line":388},[374,1728,443],{"class":412},[374,1730,718],{"class":391},[374,1732,1733],{"class":376,"line":395},[374,1734,466],{"class":391},[374,1736,1737],{"class":376,"line":409},[374,1738,472],{"emptyLinePlaceholder":7},[374,1740,1741,1743,1745],{"class":376,"line":440},[374,1742,478],{"class":398},[374,1744,481],{"class":412},[374,1746,484],{"class":391},[374,1748,1749,1751,1753,1755,1757,1759,1761],{"class":376,"line":463},[374,1750,511],{"class":391},[374,1752,514],{"class":380},[374,1754,1663],{"class":391},[374,1756,520],{"class":380},[374,1758,523],{"class":380},[374,1760,403],{"class":412},[374,1762,718],{"class":391},[374,1764,1765],{"class":376,"line":469},[374,1766,544],{"class":543},[374,1768,1769,1771],{"class":376,"line":475},[374,1770,555],{"class":380},[374,1772,1773],{"class":391}," s;\n",[374,1775,1776],{"class":376,"line":487},[374,1777,564],{"class":391},[330,1779,1781,1782,336],{"id":1780},"noncompliant-code-example-class-new","Noncompliant Code Example (Class ",[43,1783,75],{},[39,1785,1786,1787,1789,1790,1792,1793,1795,1796,1799,1800,1803,1804,1806,1807,350,1810,256],{},"In this noncompliant code example, the global ",[43,1788,75],{}," operator is overridden by a class-specific implementation of ",[43,1791,307],{}," . When ",[43,1794,75],{}," is called, the class-specific override is selected, so ",[43,1797,1798],{},"  S::operator new() "," is called. However, because the object is destroyed with a scoped ",[43,1801,1802],{},"::delete"," operator, the global ",[43,1805,311],{}," function is called instead of the class-specific implementation ",[43,1808,1809],{},"  S::operator delete() ",[60,1811,255],{"href":254},[361,1813,1814],{"quality":363},[365,1815,1817],{"className":367,"code":1816,"language":369,"meta":370,"style":370},"#include \u003Ccstdlib>\n#include \u003Cnew>\n \nstruct S {\n  static void *operator new(std::size_t size) noexcept(true) {\n    return std::malloc(size);\n  }\n  \n  static void operator delete(void *ptr) noexcept(true) {\n    std::free(ptr);\n  }\n};\n\nvoid f() {\n  S *s = new S;\n  ::delete s;\n}\n",[43,1818,1819,1825,1832,1836,1844,1881,1895,1900,1904,1933,1945,1949,1953,1957,1965,1980,1989],{"__ignoreMap":370},[374,1820,1821,1823],{"class":376,"line":377},[374,1822,381],{"class":380},[374,1824,1395],{"class":384},[374,1826,1827,1829],{"class":376,"line":388},[374,1828,381],{"class":380},[374,1830,1831],{"class":384}," \u003Cnew>\n",[374,1833,1834],{"class":376,"line":395},[374,1835,392],{"class":391},[374,1837,1838,1840,1842],{"class":376,"line":409},[374,1839,399],{"class":398},[374,1841,403],{"class":402},[374,1843,406],{"class":391},[374,1845,1846,1849,1852,1855,1857,1859,1861,1863,1866,1869,1871,1874,1876,1879],{"class":376,"line":440},[374,1847,1848],{"class":380},"  static",[374,1850,1851],{"class":398}," void",[374,1853,1854],{"class":380}," *operator",[374,1856,523],{"class":1109},[374,1858,838],{"class":391},[374,1860,419],{"class":402},[374,1862,1430],{"class":391},[374,1864,1865],{"class":398},"size_t",[374,1867,1868],{"class":847}," size",[374,1870,1076],{"class":391},[374,1872,1873],{"class":380},"noexcept",[374,1875,838],{"class":391},[374,1877,1878],{"class":1280},"true",[374,1880,906],{"class":391},[374,1882,1883,1886,1888,1890,1892],{"class":376,"line":463},[374,1884,1885],{"class":380},"    return",[374,1887,434],{"class":402},[374,1889,1430],{"class":391},[374,1891,1433],{"class":412},[374,1893,1894],{"class":391},"(size);\n",[374,1896,1897],{"class":376,"line":469},[374,1898,1899],{"class":391},"  }\n",[374,1901,1902],{"class":376,"line":475},[374,1903,825],{"class":391},[374,1905,1906,1908,1910,1912,1914,1916,1918,1920,1923,1925,1927,1929,1931],{"class":376,"line":487},[374,1907,1848],{"class":380},[374,1909,1851],{"class":398},[374,1911,1106],{"class":380},[374,1913,1081],{"class":1109},[374,1915,838],{"class":391},[374,1917,478],{"class":398},[374,1919,844],{"class":380},[374,1921,1922],{"class":847},"ptr",[374,1924,1076],{"class":391},[374,1926,1873],{"class":380},[374,1928,838],{"class":391},[374,1930,1878],{"class":1280},[374,1932,906],{"class":391},[374,1934,1935,1938,1940,1942],{"class":376,"line":508},[374,1936,1937],{"class":402},"    std",[374,1939,1430],{"class":391},[374,1941,1580],{"class":412},[374,1943,1944],{"class":391},"(ptr);\n",[374,1946,1947],{"class":376,"line":535},[374,1948,1899],{"class":391},[374,1950,1951],{"class":376,"line":540},[374,1952,466],{"class":391},[374,1954,1955],{"class":376,"line":547},[374,1956,472],{"emptyLinePlaceholder":7},[374,1958,1959,1961,1963],{"class":376,"line":552},[374,1960,478],{"class":398},[374,1962,481],{"class":412},[374,1964,484],{"class":391},[374,1966,1967,1969,1971,1973,1975,1977],{"class":376,"line":561},[374,1968,511],{"class":391},[374,1970,514],{"class":380},[374,1972,1663],{"class":391},[374,1974,520],{"class":380},[374,1976,523],{"class":380},[374,1978,1979],{"class":391}," S;\n",[374,1981,1982,1985,1987],{"class":376,"line":923},[374,1983,1984],{"class":391},"  ::",[374,1986,91],{"class":380},[374,1988,1773],{"class":391},[374,1990,1991],{"class":376,"line":928},[374,1992,564],{"class":391},[330,1994,1996,1997,336],{"id":1995},"compliant-solution-class-new","Compliant Solution (class ",[43,1998,75],{},[39,2000,2001,2002,2004,2005,1240,2007,2009],{},"In this compliant solution, the scoped ",[43,2003,1802],{}," call is replaced by a nonscoped ",[43,2006,91],{},[43,2008,1809],{}," being called.",[361,2011,2012],{"quality":583},[365,2013,2015],{"className":367,"code":2014,"language":369,"meta":370,"style":370},"#include \u003Ccstdlib>\n#include \u003Cnew>\n \nstruct S {\n  static void *operator new(std::size_t size) noexcept(true) {\n    return std::malloc(size);\n  }\n  \n  static void operator delete(void *ptr) noexcept(true) {\n    std::free(ptr);\n  }\n};\n\nvoid f() {\n  S *s = new S;\n  delete s;\n}\n",[43,2016,2017,2023,2029,2033,2041,2071,2083,2087,2091,2119,2129,2133,2137,2141,2149,2163,2169],{"__ignoreMap":370},[374,2018,2019,2021],{"class":376,"line":377},[374,2020,381],{"class":380},[374,2022,1395],{"class":384},[374,2024,2025,2027],{"class":376,"line":388},[374,2026,381],{"class":380},[374,2028,1831],{"class":384},[374,2030,2031],{"class":376,"line":395},[374,2032,599],{"class":391},[374,2034,2035,2037,2039],{"class":376,"line":409},[374,2036,399],{"class":398},[374,2038,403],{"class":402},[374,2040,406],{"class":391},[374,2042,2043,2045,2047,2049,2051,2053,2055,2057,2059,2061,2063,2065,2067,2069],{"class":376,"line":440},[374,2044,1848],{"class":380},[374,2046,1851],{"class":398},[374,2048,1854],{"class":380},[374,2050,523],{"class":1109},[374,2052,838],{"class":391},[374,2054,419],{"class":402},[374,2056,1430],{"class":391},[374,2058,1865],{"class":398},[374,2060,1868],{"class":847},[374,2062,1076],{"class":391},[374,2064,1873],{"class":380},[374,2066,838],{"class":391},[374,2068,1878],{"class":1280},[374,2070,906],{"class":391},[374,2072,2073,2075,2077,2079,2081],{"class":376,"line":463},[374,2074,1885],{"class":380},[374,2076,434],{"class":402},[374,2078,1430],{"class":391},[374,2080,1433],{"class":412},[374,2082,1894],{"class":391},[374,2084,2085],{"class":376,"line":469},[374,2086,1899],{"class":391},[374,2088,2089],{"class":376,"line":475},[374,2090,825],{"class":391},[374,2092,2093,2095,2097,2099,2101,2103,2105,2107,2109,2111,2113,2115,2117],{"class":376,"line":487},[374,2094,1848],{"class":380},[374,2096,1851],{"class":398},[374,2098,1106],{"class":380},[374,2100,1081],{"class":1109},[374,2102,838],{"class":391},[374,2104,478],{"class":398},[374,2106,844],{"class":380},[374,2108,1922],{"class":847},[374,2110,1076],{"class":391},[374,2112,1873],{"class":380},[374,2114,838],{"class":391},[374,2116,1878],{"class":1280},[374,2118,906],{"class":391},[374,2120,2121,2123,2125,2127],{"class":376,"line":508},[374,2122,1937],{"class":402},[374,2124,1430],{"class":391},[374,2126,1580],{"class":412},[374,2128,1944],{"class":391},[374,2130,2131],{"class":376,"line":535},[374,2132,1899],{"class":391},[374,2134,2135],{"class":376,"line":540},[374,2136,466],{"class":391},[374,2138,2139],{"class":376,"line":547},[374,2140,472],{"emptyLinePlaceholder":7},[374,2142,2143,2145,2147],{"class":376,"line":552},[374,2144,478],{"class":398},[374,2146,481],{"class":412},[374,2148,484],{"class":391},[374,2150,2151,2153,2155,2157,2159,2161],{"class":376,"line":561},[374,2152,511],{"class":391},[374,2154,514],{"class":380},[374,2156,1663],{"class":391},[374,2158,520],{"class":380},[374,2160,523],{"class":380},[374,2162,1979],{"class":391},[374,2164,2165,2167],{"class":376,"line":923},[374,2166,555],{"class":380},[374,2168,1773],{"class":391},[374,2170,2171],{"class":376,"line":928},[374,2172,564],{"class":391},[330,2174,1370,2176,336],{"id":2175},"noncompliant-code-example-stdunique_ptr",[43,2177,2178],{},"std::unique_ptr",[39,2180,2181,2182,2184,2185,2187,2188,1504,2190,2192],{},"In this noncompliant code example, a ",[43,2183,2178],{}," is declared to hold a pointer to an object, but is direct-initialized with an array of objects. When the ",[43,2186,2178],{}," is destroyed, its default deleter calls ",[43,2189,91],{},[43,2191,1239],{}," , resulting in undefined behavior.",[361,2194,2195],{"quality":363},[365,2196,2198],{"className":367,"code":2197,"language":369,"meta":370,"style":370},"#include \u003Cmemory>\n\nstruct S {};\n\nvoid f() {\n  std::unique_ptr\u003CS> s{new S[10]};\n}\n",[43,2199,2200,2207,2211,2219,2223,2231,2260],{"__ignoreMap":370},[374,2201,2202,2204],{"class":376,"line":377},[374,2203,381],{"class":380},[374,2205,2206],{"class":384}," \u003Cmemory>\n",[374,2208,2209],{"class":376,"line":388},[374,2210,472],{"emptyLinePlaceholder":7},[374,2212,2213,2215,2217],{"class":376,"line":395},[374,2214,399],{"class":398},[374,2216,403],{"class":402},[374,2218,796],{"class":391},[374,2220,2221],{"class":376,"line":409},[374,2222,472],{"emptyLinePlaceholder":7},[374,2224,2225,2227,2229],{"class":376,"line":440},[374,2226,478],{"class":398},[374,2228,481],{"class":412},[374,2230,484],{"class":391},[374,2232,2233,2235,2238,2241,2244,2247,2250,2252,2255,2257],{"class":376,"line":463},[374,2234,1575],{"class":402},[374,2236,2237],{"class":391},"::unique_ptr",[374,2239,2240],{"class":380},"\u003C",[374,2242,2243],{"class":391},"S",[374,2245,2246],{"class":380},">",[374,2248,2249],{"class":391}," s{",[374,2251,75],{"class":380},[374,2253,2254],{"class":391}," S[",[374,2256,1281],{"class":1280},[374,2258,2259],{"class":391},"]};\n",[374,2261,2262],{"class":376,"line":469},[374,2263,564],{"class":391},[330,2265,1493,2267,336],{"id":2266},"compliant-solution-stdunique_ptr",[43,2268,2178],{},[39,2270,2271,2272,2274,2275,2278],{},"In this compliant solution, the ",[43,2273,2178],{}," is declared to hold an array of objects instead of a pointer to an object. Additionally, ",[43,2276,2277],{},"std::make_unique()"," is used to initialize the smart pointer.",[361,2280,2281],{"quality":583},[365,2282,2284],{"className":367,"code":2283,"language":369,"meta":370,"style":370},"#include \u003Cmemory>\n\nstruct S {};\n\nvoid f() {\n  std::unique_ptr\u003CS[]> s = std::make_unique\u003CS[]>(10);\n}\n",[43,2285,2286,2292,2296,2304,2308,2316,2353],{"__ignoreMap":370},[374,2287,2288,2290],{"class":376,"line":377},[374,2289,381],{"class":380},[374,2291,2206],{"class":384},[374,2293,2294],{"class":376,"line":388},[374,2295,472],{"emptyLinePlaceholder":7},[374,2297,2298,2300,2302],{"class":376,"line":395},[374,2299,399],{"class":398},[374,2301,403],{"class":402},[374,2303,796],{"class":391},[374,2305,2306],{"class":376,"line":409},[374,2307,472],{"emptyLinePlaceholder":7},[374,2309,2310,2312,2314],{"class":376,"line":440},[374,2311,478],{"class":398},[374,2313,481],{"class":412},[374,2315,484],{"class":391},[374,2317,2318,2320,2322,2324,2327,2329,2332,2334,2336,2338,2341,2343,2345,2348,2350],{"class":376,"line":463},[374,2319,1575],{"class":402},[374,2321,2237],{"class":391},[374,2323,2240],{"class":380},[374,2325,2326],{"class":391},"S[]",[374,2328,2246],{"class":380},[374,2330,2331],{"class":391}," s ",[374,2333,520],{"class":380},[374,2335,434],{"class":402},[374,2337,1430],{"class":391},[374,2339,2340],{"class":412},"make_unique",[374,2342,2240],{"class":391},[374,2344,2243],{"class":402},[374,2346,2347],{"class":391},"[]>(",[374,2349,1281],{"class":1280},[374,2351,2352],{"class":391},");\n",[374,2354,2355],{"class":376,"line":469},[374,2356,564],{"class":391},[39,2358,2359,2360,2362,2363,2365,2366,2368],{},"Use of ",[43,2361,2277],{}," instead of direct initialization will emit a diagnostic if the resulting ",[43,2364,2178],{}," is not of the correct type. Had it been used in the noncompliant code example, the result would have been an ill-formed program instead of undefined behavior. It is best to use ",[43,2367,2277],{}," instead of manual initialization by other means.",[330,2370,1370,2372,336],{"id":2371},"noncompliant-code-example-stdshared_ptr",[43,2373,2374],{},"std::shared_ptr",[39,2376,2181,2377,2379,2380,2382,2383,2187,2385,1504,2387,2192],{},[43,2378,2374],{}," is declared to hold a pointer to an object, but is direct-initialized with an array of objects. As with ",[43,2381,2178],{}," , when the ",[43,2384,2374],{},[43,2386,91],{},[43,2388,1239],{},[361,2390,2391],{"quality":363},[365,2392,2394],{"className":367,"code":2393,"language":369,"meta":370,"style":370},"#include \u003Cmemory>\n\nstruct S {};\n\nvoid f() {\n  std::shared_ptr\u003CS> s{new S[10]};\n}\n",[43,2395,2396,2402,2406,2414,2418,2426,2449],{"__ignoreMap":370},[374,2397,2398,2400],{"class":376,"line":377},[374,2399,381],{"class":380},[374,2401,2206],{"class":384},[374,2403,2404],{"class":376,"line":388},[374,2405,472],{"emptyLinePlaceholder":7},[374,2407,2408,2410,2412],{"class":376,"line":395},[374,2409,399],{"class":398},[374,2411,403],{"class":402},[374,2413,796],{"class":391},[374,2415,2416],{"class":376,"line":409},[374,2417,472],{"emptyLinePlaceholder":7},[374,2419,2420,2422,2424],{"class":376,"line":440},[374,2421,478],{"class":398},[374,2423,481],{"class":412},[374,2425,484],{"class":391},[374,2427,2428,2430,2433,2435,2437,2439,2441,2443,2445,2447],{"class":376,"line":463},[374,2429,1575],{"class":402},[374,2431,2432],{"class":391},"::shared_ptr",[374,2434,2240],{"class":380},[374,2436,2243],{"class":391},[374,2438,2246],{"class":380},[374,2440,2249],{"class":391},[374,2442,75],{"class":380},[374,2444,2254],{"class":391},[374,2446,1281],{"class":1280},[374,2448,2259],{"class":391},[374,2450,2451],{"class":376,"line":469},[374,2452,564],{"class":391},[330,2454,1493,2456,336],{"id":2455},"compliant-solution-stdshared_ptr",[43,2457,2374],{},[39,2459,2460,2461,2463,2464,2466,2467,2470],{},"Unlike the compliant solution for ",[43,2462,2178],{}," , where ",[43,2465,2277],{}," is called to create a unique pointer to an array, it is ill-formed to call ",[43,2468,2469],{},"std::make_shared()"," with an array type. Instead, this compliant solution manually specifies a custom deleter for the shared pointer type, ensuring that the underlying array is properly deleted.",[361,2472,2473],{"quality":583},[365,2474,2476],{"className":367,"code":2475,"language":369,"meta":370,"style":370},"#include \u003Cmemory>\n\nstruct S {};\n\nvoid f() {\n  std::shared_ptr\u003CS> s{new S[10], [](const S *ptr) { delete [] ptr; }};\n}\n",[43,2477,2478,2484,2488,2496,2500,2508,2548],{"__ignoreMap":370},[374,2479,2480,2482],{"class":376,"line":377},[374,2481,381],{"class":380},[374,2483,2206],{"class":384},[374,2485,2486],{"class":376,"line":388},[374,2487,472],{"emptyLinePlaceholder":7},[374,2489,2490,2492,2494],{"class":376,"line":395},[374,2491,399],{"class":398},[374,2493,403],{"class":402},[374,2495,796],{"class":391},[374,2497,2498],{"class":376,"line":409},[374,2499,472],{"emptyLinePlaceholder":7},[374,2501,2502,2504,2506],{"class":376,"line":440},[374,2503,478],{"class":398},[374,2505,481],{"class":412},[374,2507,484],{"class":391},[374,2509,2510,2512,2514,2516,2518,2520,2522,2524,2526,2528,2531,2533,2535,2537,2539,2542,2545],{"class":376,"line":463},[374,2511,1575],{"class":402},[374,2513,2432],{"class":391},[374,2515,2240],{"class":380},[374,2517,2243],{"class":391},[374,2519,2246],{"class":380},[374,2521,2249],{"class":391},[374,2523,75],{"class":380},[374,2525,2254],{"class":391},[374,2527,1281],{"class":1280},[374,2529,2530],{"class":391},"], [](",[374,2532,1069],{"class":380},[374,2534,403],{"class":402},[374,2536,844],{"class":380},[374,2538,1922],{"class":847},[374,2540,2541],{"class":391},") { ",[374,2543,2544],{"class":380},"delete []",[374,2546,2547],{"class":391}," ptr; }};\n",[374,2549,2550],{"class":376,"line":469},[374,2551,564],{"class":391},[330,2553,2555],{"id":2554},"risk-assessment","Risk Assessment",[39,2557,2558,2559,2561,2562,256],{},"Passing a pointer value to a deallocation function that was not previously obtained by the matching allocation function results in ",[60,2560,255],{"href":254}," , which can lead to exploitable ",[60,2563,733],{"href":732},[104,2565,2566,2567,2566,2595],{},"\n  ",[2568,2569,2570,2571,2566],"thead",{},"\n    ",[112,2572,2573,2574,2573,2577,2573,2580,2573,2583,2573,2586,2573,2589,2573,2592,2570],{},"\n      ",[117,2575,2576],{},"Rule",[117,2578,2579],{},"Severity",[117,2581,2582],{},"Likelihood",[117,2584,2585],{},"Detectable",[117,2587,2588],{},"Repairable",[117,2590,2591],{},"Priority",[117,2593,2594],{},"Level",[109,2596,2570,2597,2566],{},[112,2598,2573,2599,2573,2602,2573,2605,2573,2608,2573,2611,2573,2613,2573,2620,2570],{},[128,2600,2601],{},"MEM51-CPP",[128,2603,2604],{},"High",[128,2606,2607],{},"Likely",[128,2609,2610],{},"No",[128,2612,2610],{},[128,2614,2616],{"style":2615},"color: #f1c40f;",[2617,2618,2619],"b",{},"P9",[128,2621,2622],{"style":2615},[2617,2623,2624],{},"L2",[330,2626,2628],{"id":2627},"automated-detection","Automated Detection",[104,2630,2632],{"className":2631},[107],[109,2633,2634,2657,2705,2731,2763,2802,2830,2923,2954,3008,3027,3071,3136,3165,3190],{},[112,2635,2637,2642,2647,2652],{"className":2636},[115],[117,2638,2639],{},[39,2640,2641],{},"Tool",[117,2643,2644],{},[39,2645,2646],{},"Version",[117,2648,2649],{},[39,2650,2651],{},"Checker",[117,2653,2654],{},[39,2655,2656],{},"Description",[112,2658,2660,2666,2676,2702],{"className":2659},[126],[128,2661,2662],{},[60,2663,2665],{"href":2664},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fastree","Astrée",[128,2667,2668],{},[2669,2670,2673],"div",{"className":2671},[2672],"content-wrapper",[39,2674,2675],{},"25.10",[128,2677,2678],{},[39,2679,2680,2686,2687,2686,2692,2686,2697],{},[2681,2682,2683,2684],"strong",{},"csa-memory-leak",[226,2685],{}," ",[2681,2688,2689,2690],{},"csa-mismathced-deallocator",[226,2691],{},[2681,2693,2694,2695],{},"invalid_dynamic_memory_allocation",[226,2696],{},[2681,2698,2699,2700],{},"dangling_pointer_use",[226,2701],{},[128,2703,2704],{},"partially checked + soundly supported",[112,2706,2708,2714,2722,2727],{"className":2707},[146],[128,2709,2710],{},[60,2711,2713],{"href":2712},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Faxivion-bauhaus-suite","Axivion Bauhaus Suite",[128,2715,2716],{},[2669,2717,2719],{"className":2718},[2672],[39,2720,2721],{},"7.2.0",[128,2723,2724],{},[2681,2725,2726],{},"CertC++-MEM51",[128,2728,2729],{},[226,2730],{},[112,2732,2734,2740,2746,2756],{"className":2733},[126],[128,2735,2736],{},[60,2737,2739],{"href":2738},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fclang","Clang",[128,2741,2742],{},[2669,2743,2745],{"className":2744},[2672],"3.9",[128,2747,2748,2751,2753],{},[43,2749,2750],{},"      clang-analyzer-cplusplus.NewDeleteLeaks     ",[226,2752],{},[43,2754,2755],{},"      -Wmismatched-new-delete            clang-analyzer-unix.MismatchedDeallocator     ",[128,2757,2758,2759,2762],{},"Checked by ",[43,2760,2761],{},"      clang-tidy     "," , but does not catch all violations of this rule",[112,2764,2766,2772,2778,2793],{"className":2765},[146],[128,2767,2768],{},[60,2769,2771],{"href":2770},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fcodesonar","CodeSonar",[128,2773,2774],{},[2669,2775,2777],{"className":2776},[2672],"9.1p0",[128,2779,2780],{},[39,2781,2782],{},[2681,2783,2784,2785,2787,2788,2790,2791],{},"ALLOC.DF",[226,2786],{},"\nALLOC.TM",[226,2789],{},"\nALLOC.LEAK",[226,2792],{},[128,2794,2795,2796,2798,2799,2801],{},"Double free",[226,2797],{},"\nType mismatch",[226,2800],{},"\nLeak",[112,2803,2805,2811,2819,2826],{"className":2804},[126],[128,2806,2807],{},[60,2808,2810],{"href":2809},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fhelix-qac","Helix QAC",[128,2812,2813],{},[2669,2814,2816],{"className":2815},[2672],[39,2817,2818],{},"2025.2",[128,2820,2821],{},[39,2822,2823],{},[2681,2824,2825],{},"C++2110, C++2111, C++2112, C++2113, C++2118, C++3337, C++3339, C++4262, C++4263, C++4264",[128,2827,2828],{},[226,2829],{},[112,2831,2833,2839,2844,2919],{"className":2832},[146],[128,2834,2835],{},[60,2836,2838],{"href":2837},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fklocwork","Klocwork",[128,2840,2841],{},[2669,2842,2818],{"className":2843},[2672],[128,2845,2846,2849,2851,2854,2856,2859,2861,2864,2866,2869,2871,2874,2876,2879,2881,2884,2886,2889,2891,2894,2896,2899,2901,2904,2906,2909,2911,2914,2916],{},[2681,2847,2848],{},"CL.FFM.ASSIGN",[226,2850],{},[2681,2852,2853],{},"CL.FFM.COPY",[226,2855],{},[2681,2857,2858],{},"CL.FMM",[226,2860],{},[2681,2862,2863],{},"CL.SHALLOW.ASSIGN",[226,2865],{},[2681,2867,2868],{},"CL.SHALLOW.COPY",[226,2870],{},[2681,2872,2873],{},"FMM.MIGHT",[226,2875],{},[2681,2877,2878],{},"FMM.MUST",[226,2880],{},[2681,2882,2883],{},"FNH.MIGHT",[226,2885],{},[2681,2887,2888],{},"FNH.MUST",[226,2890],{},[2681,2892,2893],{},"FUM.GEN.MIGHT",[226,2895],{},[2681,2897,2898],{},"FUM.GEN.MUST",[226,2900],{},[2681,2902,2903],{},"UNINIT.CTOR.MIGHT",[226,2905],{},[2681,2907,2908],{},"UNINIT.CTOR.MUST",[226,2910],{},[2681,2912,2913],{},"UNINIT.HEAP.MIGHT",[226,2915],{},[2681,2917,2918],{},"UNINIT.HEAP.MUST",[128,2920,2921],{},[226,2922],{},[112,2924,2926,2932,2938,2949],{"className":2925},[126],[128,2927,2928],{},[60,2929,2931],{"href":2930},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fldra","LDRA tool suite",[128,2933,2934],{},[2669,2935,2937],{"className":2936},[2672],"9.7.1",[128,2939,2940],{},[39,2941,2942,2686,2945],{},[2681,2943,2944],{},"232 S, 236 S, 239 S, 407 S, 469 S, 470 S, 483 S, 484 S, 485 S, 64 D, 112 D",[2681,2946,2947],{},[226,2948],{},[128,2950,2951],{},[39,2952,2953],{},"Partially implemented",[112,2955,2957,2963,2968,2994],{"className":2956},[146],[128,2958,2959],{},[60,2960,2962],{"href":2961},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fparasoft","Parasoft C\u002FC++test",[128,2964,2965],{},[2669,2966,2818],{"className":2967},[2672],[128,2969,2970,2990],{},[39,2971,2972,2975,2977,2980,2982,2985,2987],{},[2681,2973,2974],{},"CERT_CPP-MEM51-a",[226,2976],{},[2681,2978,2979],{},"CERT_CPP-MEM51-b",[226,2981],{},[2681,2983,2984],{},"CERT_CPP-MEM51-c",[226,2986],{},[2681,2988,2989],{},"CERT_CPP-MEM51-d",[39,2991,2992],{},[226,2993],{},[128,2995,2996],{},[39,2997,2998,2999,3001,3002,3004,3005,3007],{},"Use the same form in corresponding calls to new\u002Fmalloc and delete\u002Ffree",[226,3000],{},"\nAlways provide empty brackets ([]) for delete when deallocating arrays",[226,3003],{},"\nBoth copy constructor and copy assignment operator should be declared for classes with a nontrivial destructor",[226,3006],{},"\nProperly deallocate dynamically allocated resources",[112,3009,3011,3016,3020,3024],{"className":3010},[126],[128,3012,3013],{},[60,3014,3015],{"href":2961},"Parasoft Insure++",[128,3017,3018],{},[226,3019],{},[128,3021,3022],{},[226,3023],{},[128,3025,3026],{},"Runtime detection",[112,3028,3030,3036,3044,3050],{"className":3029},[146],[128,3031,3032],{},[60,3033,3035],{"href":3034},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fpolyspace-bug-finder","Polyspace Bug Finder",[128,3037,3038],{},[2669,3039,3041],{"className":3040},[2672],[39,3042,3043],{},"R2025b",[128,3045,3046],{},[60,3047,3049],{"href":3048},"https:\u002F\u002Fwww.mathworks.com\u002Fhelp\u002Fbugfinder\u002Fref\u002Fcertcmem51cpp.html","CERT C++: MEM51-CPP",[128,3051,3052,3055,3068],{},[39,3053,3054],{},"Checks for:",[3056,3057,3058,3062,3065],"ul",{},[3059,3060,3061],"li",{},"Invalid deletion of pointer",[3059,3063,3064],{},"Invalid free of pointer",[3059,3066,3067],{},"Deallocation of previously deallocated pointer",[39,3069,3070],{},"Rule partially covered.",[112,3072,3074,3080,3088,3132],{"className":3073},[126],[128,3075,3076],{},[60,3077,3079],{"href":3078},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fpvs-studio","PVS-Studio",[128,3081,3082],{},[2669,3083,3085],{"className":3084},[2672],[39,3086,3087],{},"7.42",[128,3089,3090,46,3096,46,3102,46,3108,46,3114,46,3120,46,3126],{},[60,3091,3093],{"href":3092},"https:\u002F\u002Fpvs-studio.com\u002Fen\u002Fdocs\u002Fwarnings\u002Fv515\u002F",[2681,3094,3095],{},"V515",[60,3097,3099],{"href":3098},"https:\u002F\u002Fpvs-studio.com\u002Fen\u002Fdocs\u002Fwarnings\u002Fv554\u002F",[2681,3100,3101],{},"V554",[60,3103,3105],{"href":3104},"https:\u002F\u002Fpvs-studio.com\u002Fen\u002Fdocs\u002Fwarnings\u002Fv611\u002F",[2681,3106,3107],{},"V611",[60,3109,3111],{"href":3110},"https:\u002F\u002Fpvs-studio.com\u002Fen\u002Fdocs\u002Fwarnings\u002Fv701\u002F",[2681,3112,3113],{},"V701",[60,3115,3117],{"href":3116},"https:\u002F\u002Fpvs-studio.com\u002Fen\u002Fdocs\u002Fwarnings\u002Fv748\u002F",[2681,3118,3119],{},"V748",[60,3121,3123],{"href":3122},"https:\u002F\u002Fpvs-studio.com\u002Fen\u002Fdocs\u002Fwarnings\u002Fv773\u002F",[2681,3124,3125],{},"V773",[2681,3127,3128],{},[60,3129,3131],{"href":3130},"https:\u002F\u002Fpvs-studio.com\u002Fen\u002Fdocs\u002Fwarnings\u002Fv1066\u002F","V1066",[128,3133,3134],{},[226,3135],{},[112,3137,3139,3145,3152,3162],{"className":3138},[146],[128,3140,3141],{},[60,3142,3144],{"href":3143},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Frulechecker","RuleChecker",[128,3146,3147],{},[2669,3148,3150],{"className":3149},[2672],[39,3151,2675],{},[128,3153,3154],{},[39,3155,3156,2686,3160],{},[2681,3157,2683,3158],{},[226,3159],{},[2681,3161,2689],{},[128,3163,3164],{},"partially checked",[112,3166,3168,3174,3182,3187],{"className":3167},[126],[128,3169,3170],{},[60,3171,3173],{"href":3172},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsecurity-reviewer-static-reviewer","Security Reviewer - Static Reviewer",[128,3175,3176],{},[2669,3177,3179],{"className":3178},[2672],[39,3180,3181],{},"6.02",[128,3183,3184],{},[2681,3185,3186],{},"wcsdupCalled",[128,3188,3189],{},"Fully implemented",[112,3191,3193,3199,3205,3213],{"className":3192},[146],[128,3194,3195],{},[60,3196,3198],{"href":3197},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsonarqube-ccpp-plugin","SonarQube C\u002FC++ Plugin",[128,3200,3201],{},[2669,3202,3204],{"className":3203},[2672],"4.10",[128,3206,3207],{},[2681,3208,3209],{},[60,3210,3212],{"href":3211},"https:\u002F\u002Fwww.sonarsource.com\u002Fproducts\u002Fcodeanalyzers\u002Fsonarcfamilyforcpp\u002Frules-cpp.html#RSPEC-1232","S1232",[128,3214,3215],{},[226,3216],{},[330,3218,3220],{"id":3219},"related-vulnerabilities","Related Vulnerabilities",[39,3222,3223,3224,3226,3227,256],{},"Search for ",[60,3225,733],{"href":732}," resulting from the violation of this rule on the ",[60,3228,3231],{"href":3229,"rel":3230},"https:\u002F\u002Fwww.kb.cert.org\u002Fvulnotes\u002Fbymetric?searchview&query=FIELD+KEYWORDS+contains+MEM31-CPP",[86],"CERT website",[330,3233,3235],{"id":3234},"related-guidelines","Related Guidelines",[104,3237,3239],{"className":3238},[107],[109,3240,3241,3255,3273],{},[112,3242,3244,3249],{"className":3243},[126],[128,3245,3246],{},[60,3247,3248],{"href":20},"SEI CERT C++ Coding Standard",[128,3250,3251],{},[39,3252,3253],{},[60,3254,322],{"href":321},[112,3256,3258,3263],{"className":3257},[146],[128,3259,3260],{},[60,3261,3262],{"href":17},"SEI CERT C Coding Standard",[128,3264,3265],{},[39,3266,3267,2686,3271],{},[60,3268,63,3269],{"href":62},[226,3270],{},[60,3272,68],{"href":67},[112,3274,3276,3282],{"className":3275},[126],[128,3277,3278],{},[60,3279,3281],{"href":3280},"http:\u002F\u002Fcwe.mitre.org\u002F","MITRE CWE",[128,3283,3284],{},[39,3285,3286,3290,3291,3293,3297,3298,3300,3304,3305,3307,3311],{},[60,3287,3289],{"href":3288},"http:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F590.html","CWE 590"," , Free of Memory Not on the Heap",[226,3292],{},[60,3294,3296],{"href":3295},"http:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F415.html","CWE 415"," , Double Free",[226,3299],{},[60,3301,3303],{"href":3302},"http:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F404.html","CWE 404"," , Improper Resource Shutdown or Release",[226,3306],{},[60,3308,3310],{"href":3309},"http:\u002F\u002Fcwe.mitre.org\u002Fdata\u002Fdefinitions\u002F762.html","CWE 762"," , Mismatched Memory Management Routines",[330,3313,3315],{"id":3314},"bibliography","Bibliography",[104,3317,3319],{"className":3318},[107],[109,3320,3321,3343,3369,3390,3408,3420],{},[112,3322,3324,3332],{"className":3323},[126],[128,3325,3326,3327,3331],{},"[ ",[60,3328,3330],{"href":3329},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Faa-bibliography#AA.Bibliography-Dowd07","Dowd 2007"," ]",[128,3333,3335,3336,64,3339,3342],{"colSpan":3334},"3","\"Attacking ",[43,3337,3338],{},"      delete     ",[43,3340,3341],{},"      delete []     "," in C++\"",[112,3344,3346,3352],{"className":3345},[146],[128,3347,3326,3348,3331],{},[60,3349,3351],{"href":3350},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Faa-bibliography#AA.Bibliography-Henricson97","Henricson 1997",[128,3353,3354,3355,3357,3358,3361,3363,3364,3357,3366],{"colSpan":3334},"Rule 8.1, \" ",[43,3356,3338],{}," should only be used with ",[43,3359,3360],{},"      new\"     ",[226,3362],{},"\nRule 8.2, \" ",[43,3365,3341],{},[43,3367,3368],{},"      new []\"     ",[112,3370,3372,3376],{"className":3371},[126],[128,3373,3326,3374,3331],{},[60,3375,263],{"href":262},[128,3377,3378],{"colSpan":3334},[39,3379,3380,3381,3383,3384,3386,3387,3389],{},"Subclause 5.3.5, \"Delete\"",[226,3382],{},"\nSubclause 12.8, \"Copying and Moving Class Objects\"",[226,3385],{},"\nSubclause 18.6.1, \"Storage Allocation and Deallocation\"",[226,3388],{},"\nSubclause 20.7.11, \"Temporary Buffers\"",[112,3391,3393,3399],{"className":3392},[146],[128,3394,3326,3395,3331],{},[60,3396,3398],{"href":3397},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Faa-bibliography#AA.Bibliography-Meyers05","Meyers 2005",[128,3400,3401,3402,64,3405,3407],{"colSpan":3334},"Item 16, \"Use the Same Form in Corresponding Uses of ",[43,3403,3404],{},"      new     ",[43,3406,3338],{}," \"",[112,3409,3411,3417],{"className":3410},[126],[128,3412,3326,3413,3331],{},[60,3414,3416],{"href":3415},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Faa-bibliography#AA.Bibliography-Seacord2013","Seacord 2013",[128,3418,3419],{"colSpan":3334},"Chapter 4, \"Dynamic Memory Management\"",[112,3421,3423,3429],{"className":3422},[146],[128,3424,3326,3425,3331],{},[60,3426,3428],{"href":3427},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Faa-bibliography#AA.Bibliography-Viega05","Viega 2005",[128,3430,3431],{"colSpan":3334},"\"Doubly Freeing Memory\"",[3433,3434],"hr",{},[39,3436,3437,2686,3444,2686,3450],{},[60,3438,3440],{"href":3439},"\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem50-cpp",[3441,3442],"img",{"src":3443},"\u002Fattachments\u002F88046682\u002F88480621.png",[60,3445,3447],{"href":3446},"\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002F",[3441,3448],{"src":3449},"\u002Fattachments\u002F88046682\u002F88475556.png",[60,3451,3453],{"href":3452},"\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem52-cpp",[3441,3454],{"src":3455},"\u002Fattachments\u002F88046682\u002F88475555.png",[3457,3458,3459],"style",{},"html pre.shiki code .sC2Qs, html code.shiki .sC2Qs{--shiki-default:#D73A49;--shiki-dark:#F97583;--shiki-sepia:#F92672}html pre.shiki code .sstjo, html code.shiki .sstjo{--shiki-default:#032F62;--shiki-dark:#9ECBFF;--shiki-sepia:#E6DB74}html pre.shiki code .sMOD_, html code.shiki .sMOD_{--shiki-default:#24292E;--shiki-dark:#E1E4E8;--shiki-sepia:#F8F8F2}html pre.shiki code .sq6CD, html code.shiki .sq6CD{--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit;--shiki-sepia:#66D9EF;--shiki-sepia-font-style:italic}html pre.shiki code .sz2Vg, html code.shiki .sz2Vg{--shiki-default:#6F42C1;--shiki-default-text-decoration:inherit;--shiki-dark:#B392F0;--shiki-dark-text-decoration:inherit;--shiki-sepia:#A6E22E;--shiki-sepia-text-decoration:underline}html pre.shiki code .srTi1, html code.shiki .srTi1{--shiki-default:#6F42C1;--shiki-dark:#B392F0;--shiki-sepia:#A6E22E}html pre.shiki code .s8-w5, html code.shiki .s8-w5{--shiki-default:#6A737D;--shiki-dark:#6A737D;--shiki-sepia:#88846F}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html.sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html pre.shiki code .sTHNf, html code.shiki .sTHNf{--shiki-default:#E36209;--shiki-default-font-style:inherit;--shiki-dark:#FFAB70;--shiki-dark-font-style:inherit;--shiki-sepia:#FD971F;--shiki-sepia-font-style:italic}html pre.shiki code .s_OQ2, html code.shiki .s_OQ2{--shiki-default:#6F42C1;--shiki-dark:#B392F0;--shiki-sepia:#F8F8F2}html pre.shiki code .s7F3e, html code.shiki .s7F3e{--shiki-default:#005CC5;--shiki-dark:#79B8FF;--shiki-sepia:#AE81FF}",{"title":370,"searchDepth":388,"depth":388,"links":3461},[3462,3464,3466,3467,3468,3470,3472,3474,3476,3477,3479,3481,3483,3485,3487,3489,3491,3493,3495,3496,3497,3498,3499],{"id":332,"depth":388,"text":3463},"Noncompliant Code Example (placement new() )",{"id":567,"depth":388,"text":3465},"Compliant Solution (placement new() )",{"id":725,"depth":388,"text":726},{"id":981,"depth":388,"text":982},{"id":1224,"depth":388,"text":3469},"Noncompliant Code Example (array new[] )",{"id":1302,"depth":388,"text":3471},"Compliant Solution ( array new[] )",{"id":1308,"depth":388,"text":3473},"In the compliant solution, the code is fixed by replacing the call to delete with a call to   delete []  to adhere to the correct pairing of memory allocation and deallocation functions.",{"id":1369,"depth":388,"text":3475},"Noncompliant Code Example ( malloc() )",{"id":1468,"depth":388,"text":1469},{"id":1492,"depth":388,"text":3478},"Compliant Solution ( malloc() )",{"id":1590,"depth":388,"text":3480},"Noncompliant Code Example ( new )",{"id":1698,"depth":388,"text":3482},"Compliant Solution ( new )",{"id":1780,"depth":388,"text":3484},"Noncompliant Code Example (Class new )",{"id":1995,"depth":388,"text":3486},"Compliant Solution (class new )",{"id":2175,"depth":388,"text":3488},"Noncompliant Code Example ( std::unique_ptr )",{"id":2266,"depth":388,"text":3490},"Compliant Solution ( std::unique_ptr )",{"id":2371,"depth":388,"text":3492},"Noncompliant Code Example ( std::shared_ptr )",{"id":2455,"depth":388,"text":3494},"Compliant Solution ( std::shared_ptr )",{"id":2554,"depth":388,"text":2555},{"id":2627,"depth":388,"text":2628},{"id":3219,"depth":388,"text":3220},{"id":3234,"depth":388,"text":3235},{"id":3314,"depth":388,"text":3315},"The C programming language provides several ways to allocate memory, such as std::malloc() , std::calloc() , and std::realloc() , which can be used by a C++ program. However, the C programming language defines only a single way to free the allocated memory: std::free() . See MEM31-C. Free dynamically allocated memory when no longer needed and MEM34-C. Only free memory allocated dynamically for rules specifically regarding C allocation and deallocation requirements.","md",{"tags":3503},[3504,3505,3506,3507,3508,3509,3510,3511,3512,3513,3514,3515,3516],"review","cwe-404","cwe-590","cwe-415","review-dms","rule","nptc-aliasing","notes","mem","review-ajb","nptc-wpa","nptc","cwe-762","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem51-cpp",{"title":30,"description":3500},"5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F3.mem51-cpp","k1FOoLLkjOKGfWbU3m3EoUenqJEukAKFg4MQ68hwlGc",[3522,3525],{"title":3523,"path":3439,"stem":3524,"children":-1},"MEM50-CPP. Do not access freed memory","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F2.mem50-cpp",{"title":3526,"path":3452,"stem":3527,"children":-1},"MEM52-CPP. Detect and handle memory allocation errors","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F4.mem52-cpp",[3529],{"title":3248,"path":3530,"stem":3531,"children":3532},"\u002Fsei-cert-cpp-coding-standard","5.sei-cert-cpp-coding-standard\u002F1.index",[3533,3534,3601,3994,4195,4205],{"title":3248,"path":3530,"stem":3531},{"title":3535,"path":3536,"stem":3537,"children":3538},"Front Matter","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F1.index",[3539,3540],{"title":3535,"path":3536,"stem":3537},{"title":3541,"path":3542,"stem":3543,"children":3544},"Introduction","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F01.index",[3545,3546,3550,3554,3558,3562,3566,3570,3574,3578,3582,3586,3590,3594,3598],{"title":3541,"path":3542,"stem":3543},{"title":3547,"path":3548,"stem":3549},"Scope","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fscope","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F02.scope",{"title":3551,"path":3552,"stem":3553},"Audience","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Faudience","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F03.audience",{"title":3555,"path":3556,"stem":3557},"Usage","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fusage","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F04.usage",{"title":3559,"path":3560,"stem":3561},"How this Coding Standard Is Organized","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fhow-this-coding-standard-is-organized","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F05.how-this-coding-standard-is-organized",{"title":3563,"path":3564,"stem":3565},"Relation to the CERT C Coding Standard","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Frelation-to-the-cert-c-coding-standard","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F06.relation-to-the-cert-c-coding-standard",{"title":3567,"path":3568,"stem":3569},"Rules Versus Recommendations","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Frules-versus-recommendations","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F07.rules-versus-recommendations",{"title":3571,"path":3572,"stem":3573},"Tool Selection and Validation","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Ftool-selection-and-validation","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F08.tool-selection-and-validation",{"title":3575,"path":3576,"stem":3577},"Conformance Testing","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fconformance-testing","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F09.conformance-testing",{"title":3579,"path":3580,"stem":3581},"Development Process","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fdevelopment-process","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F10.development-process",{"title":3583,"path":3584,"stem":3585},"System Qualities","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fsystem-qualities","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F11.system-qualities",{"title":3587,"path":3588,"stem":3589},"Automatically Generated Code","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fautomatically-generated-code","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F12.automatically-generated-code",{"title":3591,"path":3592,"stem":3593},"Government Regulations","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fgovernment-regulations","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F13.government-regulations",{"title":3595,"path":3596,"stem":3597},"Acknowledgments","\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Facknowledgments","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F14.acknowledgments",{"title":2628,"path":3599,"stem":3600},"\u002Fsei-cert-cpp-coding-standard\u002Ffront-matter\u002Fintroduction\u002Fautomated-detection","5.sei-cert-cpp-coding-standard\u002F2.front-matter\u002F2.introduction\u002F15.automated-detection",{"title":3602,"path":3603,"stem":3604,"children":3605},"Rules","\u002Fsei-cert-cpp-coding-standard\u002Frules","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F01.index",[3606,3607,3629,3663,3705,3755,3813,3875,3889,3899,3926,3952],{"title":3602,"path":3603,"stem":3604},{"title":3608,"path":3609,"stem":3610,"children":3611},"Characters and Strings (STR)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcharacters-and-strings-str","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F02.characters-and-strings-str\u002F1.index",[3612,3613,3617,3621,3625],{"title":3608,"path":3609,"stem":3610},{"title":3614,"path":3615,"stem":3616},"STR50-CPP. Guarantee that storage for strings has sufficient space for character data and the null terminator","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcharacters-and-strings-str\u002Fstr50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F02.characters-and-strings-str\u002F2.str50-cpp",{"title":3618,"path":3619,"stem":3620},"STR52-CPP. Use valid references, pointers, and iterators to reference elements of a basic_string","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcharacters-and-strings-str\u002Fstr52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F02.characters-and-strings-str\u002F3.str52-cpp",{"title":3622,"path":3623,"stem":3624},"STR53-CPP. Range check element access","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcharacters-and-strings-str\u002Fstr53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F02.characters-and-strings-str\u002F4.str53-cpp",{"title":3626,"path":3627,"stem":3628},"string from a null pointer","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcharacters-and-strings-str\u002Fstring-from-a-null-pointer","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F02.characters-and-strings-str\u002F5.string-from-a-null-pointer",{"title":3630,"path":3631,"stem":3632,"children":3633},"Concurrency (CON)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F1.index",[3634,3635,3639,3643,3647,3651,3655,3659],{"title":3630,"path":3631,"stem":3632},{"title":3636,"path":3637,"stem":3638},"CON50-CPP. Do not destroy a mutex while it is locked","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con\u002Fcon50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F2.con50-cpp",{"title":3640,"path":3641,"stem":3642},"CON51-CPP. Ensure actively held locks are released on exceptional conditions","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con\u002Fcon51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F3.con51-cpp",{"title":3644,"path":3645,"stem":3646},"CON52-CPP. Prevent data races when accessing bit-fields from multiple threads","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con\u002Fcon52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F4.con52-cpp",{"title":3648,"path":3649,"stem":3650},"CON53-CPP. Avoid deadlock by locking in a predefined order","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con\u002Fcon53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F5.con53-cpp",{"title":3652,"path":3653,"stem":3654},"CON54-CPP. Wrap functions that can spuriously wake up in a loop","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con\u002Fcon54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F6.con54-cpp",{"title":3656,"path":3657,"stem":3658},"CON55-CPP. Preserve thread safety and liveness when using condition variables","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con\u002Fcon55-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F7.con55-cpp",{"title":3660,"path":3661,"stem":3662},"CON56-CPP. Do not speculatively lock a non-recursive mutex that is already owned by the calling thread","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fconcurrency-con\u002Fcon56-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F03.concurrency-con\u002F8.con56-cpp",{"title":3664,"path":3665,"stem":3666,"children":3667},"Containers (CTR)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F01.index",[3668,3669,3673,3677,3681,3685,3689,3693,3697,3701],{"title":3664,"path":3665,"stem":3666},{"title":3670,"path":3671,"stem":3672},"CTR50-CPP. Guarantee that container indices and iterators are within the valid range","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F02.ctr50-cpp",{"title":3674,"path":3675,"stem":3676},"CTR51-CPP. Use valid references, pointers, and iterators to reference elements of a container","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F03.ctr51-cpp",{"title":3678,"path":3679,"stem":3680},"CTR52-CPP. Guarantee that library functions do not overflow","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F04.ctr52-cpp",{"title":3682,"path":3683,"stem":3684},"CTR53-CPP. Use valid iterator ranges","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F05.ctr53-cpp",{"title":3686,"path":3687,"stem":3688},"CTR54-CPP. Do not subtract iterators that do not refer to the same container","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F06.ctr54-cpp",{"title":3690,"path":3691,"stem":3692},"CTR55-CPP. Do not use an additive operator on an iterator if the result would overflow","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr55-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F07.ctr55-cpp",{"title":3694,"path":3695,"stem":3696},"CTR56-CPP. Do not use pointer arithmetic on polymorphic objects","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr56-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F08.ctr56-cpp",{"title":3698,"path":3699,"stem":3700},"CTR57-CPP. Provide a valid ordering predicate","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr57-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F09.ctr57-cpp",{"title":3702,"path":3703,"stem":3704},"CTR58-CPP. Predicate function objects should not be mutable","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fcontainers-ctr\u002Fctr58-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F04.containers-ctr\u002F10.ctr58-cpp",{"title":3706,"path":3707,"stem":3708,"children":3709},"Declarations and Initialization (DCL)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F01.index",[3710,3711,3715,3719,3723,3727,3731,3735,3739,3743,3747,3751],{"title":3706,"path":3707,"stem":3708},{"title":3712,"path":3713,"stem":3714},"DCL50-CPP. Do not define a C-style variadic function","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F02.dcl50-cpp",{"title":3716,"path":3717,"stem":3718},"DCL51-CPP. Do not declare or define a reserved identifier","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F03.dcl51-cpp",{"title":3720,"path":3721,"stem":3722},"DCL52-CPP. Never qualify a reference type with const or volatile","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F04.dcl52-cpp",{"title":3724,"path":3725,"stem":3726},"DCL53-CPP. Do not write syntactically ambiguous declarations","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F05.dcl53-cpp",{"title":3728,"path":3729,"stem":3730},"DCL54-CPP. Overload allocation and deallocation functions as a pair in the same scope","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F06.dcl54-cpp",{"title":3732,"path":3733,"stem":3734},"DCL55-CPP. Avoid information leakage when passing a class object across a trust boundary","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl55-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F07.dcl55-cpp",{"title":3736,"path":3737,"stem":3738},"DCL56-CPP. Avoid cycles during initialization of static objects","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl56-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F08.dcl56-cpp",{"title":3740,"path":3741,"stem":3742},"DCL57-CPP. Do not let exceptions escape from destructors or deallocation functions","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl57-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F09.dcl57-cpp",{"title":3744,"path":3745,"stem":3746},"DCL58-CPP. Do not modify the standard namespaces","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl58-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F10.dcl58-cpp",{"title":3748,"path":3749,"stem":3750},"DCL59-CPP. Do not define an unnamed namespace in a header file","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl59-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F11.dcl59-cpp",{"title":3752,"path":3753,"stem":3754},"DCL60-CPP. Obey the one-definition rule","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fdeclarations-and-initialization-dcl\u002Fdcl60-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F05.declarations-and-initialization-dcl\u002F12.dcl60-cpp",{"title":3756,"path":3757,"stem":3758,"children":3759},"Exceptions and Error Handling (ERR)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F01.index",[3760,3761,3765,3769,3773,3777,3781,3785,3789,3793,3797,3801,3805,3809],{"title":3756,"path":3757,"stem":3758},{"title":3762,"path":3763,"stem":3764},"ERR50-CPP. Do not abruptly terminate the program","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F02.err50-cpp",{"title":3766,"path":3767,"stem":3768},"ERR51-CPP. Handle all exceptions","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F03.err51-cpp",{"title":3770,"path":3771,"stem":3772},"ERR52-CPP. Do not use setjmp() or longjmp()","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F04.err52-cpp",{"title":3774,"path":3775,"stem":3776},"ERR53-CPP. Do not reference base classes or class data members in a constructor or destructor function-try-block handler","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F05.err53-cpp",{"title":3778,"path":3779,"stem":3780},"ERR54-CPP. Catch handlers should order their parameter types from most derived to least derived","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F06.err54-cpp",{"title":3782,"path":3783,"stem":3784},"ERR55-CPP. Honor exception specifications","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr55-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F07.err55-cpp",{"title":3786,"path":3787,"stem":3788},"ERR56-CPP. Guarantee exception safety","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr56-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F08.err56-cpp",{"title":3790,"path":3791,"stem":3792},"ERR57-CPP. Do not leak resources when handling exceptions","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr57-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F09.err57-cpp",{"title":3794,"path":3795,"stem":3796},"ERR58-CPP. Handle all exceptions thrown before main() begins executing","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr58-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F10.err58-cpp",{"title":3798,"path":3799,"stem":3800},"ERR59-CPP. Do not throw an exception across execution boundaries","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr59-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F11.err59-cpp",{"title":3802,"path":3803,"stem":3804},"ERR60-CPP. Exception objects must be nothrow copy constructible","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr60-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F12.err60-cpp",{"title":3806,"path":3807,"stem":3808},"ERR61-CPP. Catch exceptions by lvalue reference","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr61-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F13.err61-cpp",{"title":3810,"path":3811,"stem":3812},"ERR62-CPP. Detect errors when converting a string to a number","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexceptions-and-error-handling-err\u002Ferr62-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F06.exceptions-and-error-handling-err\u002F14.err62-cpp",{"title":3814,"path":3815,"stem":3816,"children":3817},"Expressions (EXP)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F01.index",[3818,3819,3823,3827,3831,3835,3839,3843,3847,3851,3855,3859,3863,3867,3871],{"title":3814,"path":3815,"stem":3816},{"title":3820,"path":3821,"stem":3822},"EXP50-CPP. Do not depend on the order of evaluation for side effects","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F02.exp50-cpp",{"title":3824,"path":3825,"stem":3826},"EXP51-CPP. Do not delete an array through a pointer of the incorrect type","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F03.exp51-cpp",{"title":3828,"path":3829,"stem":3830},"EXP52-CPP. Do not rely on side effects in unevaluated operands","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F04.exp52-cpp",{"title":3832,"path":3833,"stem":3834},"EXP53-CPP. Do not read uninitialized memory","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F05.exp53-cpp",{"title":3836,"path":3837,"stem":3838},"EXP54-CPP. Do not access an object outside of its lifetime","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F06.exp54-cpp",{"title":3840,"path":3841,"stem":3842},"EXP55-CPP. Do not access a cv-qualified object through a cv-unqualified type","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp55-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F07.exp55-cpp",{"title":3844,"path":3845,"stem":3846},"EXP56-CPP. Do not call a function with a mismatched language linkage","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp56-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F08.exp56-cpp",{"title":3848,"path":3849,"stem":3850},"EXP57-CPP. Do not cast or delete pointers to incomplete classes","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp57-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F09.exp57-cpp",{"title":3852,"path":3853,"stem":3854},"EXP58-CPP. Pass an object of the correct type to va_start","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp58-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F10.exp58-cpp",{"title":3856,"path":3857,"stem":3858},"EXP59-CPP. Use offsetof() on valid types and members","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp59-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F11.exp59-cpp",{"title":3860,"path":3861,"stem":3862},"EXP60-CPP. Do not pass a nonstandard-layout type object across execution boundaries","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp60-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F12.exp60-cpp",{"title":3864,"path":3865,"stem":3866},"EXP61-CPP. A lambda object must not outlive any of its reference captured objects","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp61-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F13.exp61-cpp",{"title":3868,"path":3869,"stem":3870},"EXP62-CPP. Do not access the bits of an object representation that are not part of the object's value representation","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp62-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F14.exp62-cpp",{"title":3872,"path":3873,"stem":3874},"EXP63-CPP. Do not rely on the value of a moved-from object","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fexpressions-exp\u002Fexp63-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F07.expressions-exp\u002F15.exp63-cpp",{"title":3876,"path":3877,"stem":3878,"children":3879},"Input Output (FIO)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Finput-output-fio","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F08.input-output-fio\u002F1.index",[3880,3881,3885],{"title":3876,"path":3877,"stem":3878},{"title":3882,"path":3883,"stem":3884},"FIO50-CPP. Do not alternately input and output from a file stream without an intervening positioning call","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Finput-output-fio\u002Ffio50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F08.input-output-fio\u002F2.fio50-cpp",{"title":3886,"path":3887,"stem":3888},"FIO51-CPP. Close files when they are no longer needed","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Finput-output-fio\u002Ffio51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F08.input-output-fio\u002F3.fio51-cpp",{"title":3890,"path":3891,"stem":3892,"children":3893},"Integers (INT)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fintegers-int","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F09.integers-int\u002F1.index",[3894,3895],{"title":3890,"path":3891,"stem":3892},{"title":3896,"path":3897,"stem":3898},"INT50-CPP. Do not cast to an out-of-range enumeration value","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fintegers-int\u002Fint50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F09.integers-int\u002F2.int50-cpp",{"title":3900,"path":3901,"stem":3902,"children":3903},"Memory Management (MEM)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F1.index",[3904,3905,3906,3907,3908,3910,3914,3918,3922],{"title":3900,"path":3901,"stem":3902},{"title":3523,"path":3439,"stem":3524},{"title":30,"path":3517,"stem":3519},{"title":3526,"path":3452,"stem":3527},{"title":322,"path":321,"stem":3909},"5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F5.mem53-cpp",{"title":3911,"path":3912,"stem":3913},"MEM54-CPP. Provide placement new with properly aligned pointers to sufficient storage capacity","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F6.mem54-cpp",{"title":3915,"path":3916,"stem":3917},"MEM55-CPP. Honor replacement dynamic storage management requirements","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem55-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F7.mem55-cpp",{"title":3919,"path":3920,"stem":3921},"MEM56-CPP. Do not store an already-owned pointer value in an unrelated smart pointer","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem56-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F8.mem56-cpp",{"title":3923,"path":3924,"stem":3925},"MEM57-CPP. Avoid using default operator new for over-aligned types","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmemory-management-mem\u002Fmem57-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F10.memory-management-mem\u002F9.mem57-cpp",{"title":3927,"path":3928,"stem":3929,"children":3930},"Miscellaneous (MSC)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmiscellaneous-msc","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F11.miscellaneous-msc\u002F1.index",[3931,3932,3936,3940,3944,3948],{"title":3927,"path":3928,"stem":3929},{"title":3933,"path":3934,"stem":3935},"MSC51-CPP. Ensure your random number generator is properly seeded","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmiscellaneous-msc\u002Fmsc51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F11.miscellaneous-msc\u002F2.msc51-cpp",{"title":3937,"path":3938,"stem":3939},"MSC52-CPP. Value-returning functions must return a value from all exit paths","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmiscellaneous-msc\u002Fmsc52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F11.miscellaneous-msc\u002F3.msc52-cpp",{"title":3941,"path":3942,"stem":3943},"MSC53-CPP. Do not return from a function declared [[noreturn]]","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmiscellaneous-msc\u002Fmsc53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F11.miscellaneous-msc\u002F4.msc53-cpp",{"title":3945,"path":3946,"stem":3947},"MSC54-CPP. A signal handler must be a plain old function","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmiscellaneous-msc\u002Fmsc54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F11.miscellaneous-msc\u002F5.msc54-cpp",{"title":3949,"path":3950,"stem":3951},"rand() for generating pseudorandom numbers","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fmiscellaneous-msc\u002Frand-for-generating-pseudorandom-numbers","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F11.miscellaneous-msc\u002F6.rand-for-generating-pseudorandom-numbers",{"title":3953,"path":3954,"stem":3955,"children":3956},"Object Oriented Programming (OOP)","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F01.index",[3957,3958,3962,3966,3970,3974,3978,3982,3986,3990],{"title":3953,"path":3954,"stem":3955},{"title":3959,"path":3960,"stem":3961},"OOP50-CPP. Do not invoke virtual functions from constructors or destructors","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop50-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F02.oop50-cpp",{"title":3963,"path":3964,"stem":3965},"OOP51-CPP. Do not slice derived objects","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop51-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F03.oop51-cpp",{"title":3967,"path":3968,"stem":3969},"OOP52-CPP. Do not delete a polymorphic object without a virtual destructor","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop52-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F04.oop52-cpp",{"title":3971,"path":3972,"stem":3973},"OOP53-CPP. Write constructor member initializers in the canonical order","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop53-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F05.oop53-cpp",{"title":3975,"path":3976,"stem":3977},"OOP54-CPP. Gracefully handle self-copy assignment","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop54-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F06.oop54-cpp",{"title":3979,"path":3980,"stem":3981},"OOP55-CPP. Do not use pointer-to-member operators to access nonexistent members","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop55-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F07.oop55-cpp",{"title":3983,"path":3984,"stem":3985},"OOP56-CPP. Honor replacement handler requirements","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop56-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F08.oop56-cpp",{"title":3987,"path":3988,"stem":3989},"OOP57-CPP. Prefer special member functions and overloaded operators to C Standard Library functions","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop57-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F09.oop57-cpp",{"title":3991,"path":3992,"stem":3993},"OOP58-CPP. Copy operations must not mutate the source object","\u002Fsei-cert-cpp-coding-standard\u002Frules\u002Fobject-oriented-programming-oop\u002Foop58-cpp","5.sei-cert-cpp-coding-standard\u002F3.rules\u002F12.object-oriented-programming-oop\u002F10.oop58-cpp",{"title":3995,"path":3996,"stem":3997,"children":3998},"Back Matter","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F1.index",[3999,4000,4004,4008,4178,4191],{"title":3995,"path":3996,"stem":3997},{"title":4001,"path":4002,"stem":4003},"AA. Bibliography","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Faa-bibliography","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F2.aa-bibliography",{"title":4005,"path":4006,"stem":4007},"BB. Definitions","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fbb-definitions","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F3.bb-definitions",{"title":4009,"path":4010,"stem":4011,"children":4012},"CC. Analyzers","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F01.index",[4013,4014,4016,4020,4022,4026,4028,4032,4036,4040,4044,4048,4052,4054,4058,4062,4066,4070,4074,4078,4082,4086,4090,4092,4096,4098,4102,4105,4109,4112,4116,4118,4122,4126,4130,4132,4136,4140,4144,4146,4150,4152,4156,4160,4164,4166,4170,4174],{"title":4009,"path":4010,"stem":4011},{"title":2665,"path":2664,"stem":4015},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F02.astree",{"title":4017,"path":4018,"stem":4019},"Astrée_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fastree_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F03.astree_v",{"title":2713,"path":2712,"stem":4021},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F04.axivion-bauhaus-suite",{"title":4023,"path":4024,"stem":4025},"Axivion Bauhaus Suite_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Faxivion-bauhaus-suite_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F05.axivion-bauhaus-suite_v",{"title":2739,"path":2738,"stem":4027},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F06.clang",{"title":4029,"path":4030,"stem":4031},"Clang_38_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fclang_38_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F07.clang_38_v",{"title":4033,"path":4034,"stem":4035},"Clang_39_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fclang_39_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F08.clang_39_v",{"title":4037,"path":4038,"stem":4039},"Clang_40_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fclang_40_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F09.clang_40_v",{"title":4041,"path":4042,"stem":4043},"Clang_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fclang_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F10.clang_v",{"title":4045,"path":4046,"stem":4047},"Codee","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fcodee","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F11.codee",{"title":4049,"path":4050,"stem":4051},"Codee_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fcodee_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F12.codee_v",{"title":2771,"path":2770,"stem":4053},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F13.codesonar",{"title":4055,"path":4056,"stem":4057},"CodeSonar_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fcodesonar_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F14.codesonar_v",{"title":4059,"path":4060,"stem":4061},"Coverity","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fcoverity","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F15.coverity",{"title":4063,"path":4064,"stem":4065},"Coverity_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fcoverity_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F16.coverity_v",{"title":4067,"path":4068,"stem":4069},"ECLAIR","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Feclair","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F17.eclair",{"title":4071,"path":4072,"stem":4073},"ECLAIR_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Feclair_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F18.eclair_v",{"title":4075,"path":4076,"stem":4077},"EDG","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fedg","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F19.edg",{"title":4079,"path":4080,"stem":4081},"Edg_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fedg_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F20.edg_v",{"title":4083,"path":4084,"stem":4085},"GCC","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fgcc","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F21.gcc",{"title":4087,"path":4088,"stem":4089},"Gcc_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fgcc_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F22.gcc_v",{"title":2810,"path":2809,"stem":4091},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F23.helix-qac",{"title":4093,"path":4094,"stem":4095},"Helix QAC_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fhelix-qac_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F24.helix-qac_v",{"title":2838,"path":2837,"stem":4097},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F25.klocwork",{"title":4099,"path":4100,"stem":4101},"Klocwork_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fklocwork_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F26.klocwork_v",{"title":4103,"path":2930,"stem":4104},"LDRA","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F27.ldra",{"title":4106,"path":4107,"stem":4108},"Ldra_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fldra_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F28.ldra_v",{"title":4110,"path":2961,"stem":4111},"Parasoft","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F29.parasoft",{"title":4113,"path":4114,"stem":4115},"Parasoft_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fparasoft_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F30.parasoft_v",{"title":3035,"path":3034,"stem":4117},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F31.polyspace-bug-finder",{"title":4119,"path":4120,"stem":4121},"Polyspace Bug Finder_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fpolyspace-bug-finder_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F32.polyspace-bug-finder_v",{"title":4123,"path":4124,"stem":4125},"PRQA QA-C++","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fprqa-qa-cpp","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F33.prqa-qa-cpp",{"title":4127,"path":4128,"stem":4129},"PRQA QA-C++_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fprqa-qa-cpp_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F34.prqa-qa-cpp_v",{"title":3079,"path":3078,"stem":4131},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F35.pvs-studio",{"title":4133,"path":4134,"stem":4135},"PVS-Studio_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fpvs-studio_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F36.pvs-studio_v",{"title":4137,"path":4138,"stem":4139},"Rose","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Frose","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F37.rose",{"title":4141,"path":4142,"stem":4143},"Rose_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Frose_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F38.rose_v",{"title":3144,"path":3143,"stem":4145},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F39.rulechecker",{"title":4147,"path":4148,"stem":4149},"RuleChecker_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Frulechecker_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F40.rulechecker_v",{"title":3173,"path":3172,"stem":4151},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F41.security-reviewer-static-reviewer",{"title":4153,"path":4154,"stem":4155},"Security Reviewer - Static Reviewer_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsecurity-reviewer-static-reviewer_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F42.security-reviewer-static-reviewer_v",{"title":4157,"path":4158,"stem":4159},"Semgrep","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsemgrep","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F43.semgrep",{"title":4161,"path":4162,"stem":4163},"Semgrep_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsemgrep_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F44.semgrep_v",{"title":3198,"path":3197,"stem":4165},"5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F45.sonarqube-ccpp-plugin",{"title":4167,"path":4168,"stem":4169},"SonarQube C\u002FC++ Plugin_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsonarqube-ccpp-plugin_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F46.sonarqube-ccpp-plugin_v",{"title":4171,"path":4172,"stem":4173},"Splint","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsplint","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F47.splint",{"title":4175,"path":4176,"stem":4177},"Splint_V","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fcc-analyzers\u002Fsplint_v","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F4.cc-analyzers\u002F48.splint_v",{"title":4179,"path":4180,"stem":4181,"children":4182},"DD. Related Guidelines","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fdd-related-guidelines","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F5.dd-related-guidelines\u002F1.index",[4183,4184,4188],{"title":4179,"path":4180,"stem":4181},{"title":4185,"path":4186,"stem":4187},"2008","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fdd-related-guidelines\u002F2.2008","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F5.dd-related-guidelines\u002F2.2008",{"title":3281,"path":4189,"stem":4190},"\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fdd-related-guidelines\u002Fmitre-cwe","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F5.dd-related-guidelines\u002F3.mitre-cwe",{"title":4192,"path":4193,"stem":4194},"EE. Risk Assessments","\u002Fsei-cert-cpp-coding-standard\u002Fback-matter\u002Fee-risk-assessments","5.sei-cert-cpp-coding-standard\u002F4.back-matter\u002F6.ee-risk-assessments",{"title":4196,"path":4197,"stem":4198,"children":4199},"Admin","\u002Fsei-cert-cpp-coding-standard\u002Fadmin","5.sei-cert-cpp-coding-standard\u002F5.admin\u002F1.index",[4200,4201],{"title":4196,"path":4197,"stem":4198},{"title":4202,"path":4203,"stem":4204},"TODO List","\u002Fsei-cert-cpp-coding-standard\u002Fadmin\u002Ftodo-list","5.sei-cert-cpp-coding-standard\u002F5.admin\u002F2.todo-list",{"title":4206,"path":4207,"stem":4208},"Errata for SEI CERT C++ Coding Standard (2016 Edition)","\u002Fsei-cert-cpp-coding-standard\u002Ferrata-for-sei-cert-cpp-coding-standard-2016-edition","5.sei-cert-cpp-coding-standard\u002F6.errata-for-sei-cert-cpp-coding-standard-2016-edition",1775657782009]