Skip to content

Commit 6dc566c

Browse files
Updated C6308
Acrolinx changes
1 parent 6d99907 commit 6dc566c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/code-quality/c6308.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Example output:
1515
1616
## Description
1717

18-
This warning indicates a memory leak due to the unsafe use of a reallocation function. Heap reallocation functions do not free the passed buffer if reallocation is unsuccessful. To correct the issue, assign the result of the reallocation function to a temporary location, and then replace the original pointer after successful reallocation.
18+
This warning indicates a memory leak due to the unsafe use of a reallocation function. Heap reallocation functions don't free the passed buffer if reallocation is unsuccessful. To correct the issue, assign the result of the reallocation function to a temporary location, and then replace the original pointer after successful reallocation.
1919

2020
## Example
2121

@@ -38,7 +38,7 @@ void f( )
3838
}
3939
```
4040
41-
To resolve the issue, you can create a temporary variable to store the return status of realloc. This allows you to free the previously allocated memory safely in the case of realloc failing:
41+
To resolve the issue, you can create a temporary variable to store the return status of realloc. This change allows you to free the previously allocated memory safely if realloc fails:
4242
4343
```cpp
4444
#include <malloc.h>
@@ -61,7 +61,7 @@ void f()
6161
}
6262
```
6363

64-
This warning might generate noise if there is a live alias to the buffer-to-be-reallocated at the time of the assignment of the result of the reallocation function.
64+
This warning might generate noise if there's a live alias to the buffer-to-be-reallocated at the time of the assignment of the result of the reallocation function.
6565

6666
To avoid these kinds of issues altogether, you can use the mechanisms that are provided by the C++ Standard Template Library (STL). These include [shared_ptr](../standard-library/shared-ptr-class.md), [unique_ptr](../standard-library/unique-ptr-class.md), and [vector](../standard-library/vector.md). For more information, see [Smart Pointers](../cpp/smart-pointers-modern-cpp.md) and [C++ Standard Library](../standard-library/cpp-standard-library-reference.md).
6767

0 commit comments

Comments
 (0)