Skip to content

Commit 14ca55f

Browse files
Updated C6101
Updated to the latest format
1 parent 28133c6 commit 14ca55f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/code-quality/c6101.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
description: "Learn more about: C6101"
33
title: C6101
4-
ms.date: 11/04/2016
4+
ms.date: 08/17/2022
55
ms.topic: reference
6-
f1_keywords: ["C6101"]
6+
f1_keywords: ["C6101", "RETURN_UNINIT_VAR", "__WARNING_RETURN_UNINIT_VAR"]
77
helpviewer_keywords: ["C6101"]
88
ms.assetid: 8546367c-5de5-479a-a231-c15c0aa89ef1
99
---
10-
# C6101
10+
# Warning C6101
1111

12-
**Warning C6101: Returning uninitialized memory**\
13-
Example output:
1412
> Returning uninitialized memory '\**parameter-name*'. A successful path through the function does not set the named \_Out\_ parameter.
1513
16-
## Description
14+
## Remarks
1715

1816
This message is generated based on SAL annotations that indicate that the function in question always succeeds. A function that doesn't return a success/failure indication should set all of its `_Out_` parameters because the analyzer assumes that the `_Out_` parameter is uninitialized data before the function is called, and that the function will set the parameter so that it's no longer uninitialized. If, however, the function does indicate success/failure and failure occurs, then the `_Out_` parameter doesn't have to be set. You can then detect and avoid the uninitialized location. In either case, the objective is to avoid the reading of an uninitialized location. If the function sometimes doesn't touch an `_Out_` parameter that's later used, then the parameter should be initialized before the function call and be marked with the `_Inout_` annotation, or the more explicit `_Pre_null_` or `_Pre_satisfies_()` when appropriate. "Partial success" can be handled with the `_When_` annotation. For more information, see [Using SAL Annotations to Reduce C/C++ Code Defects](../code-quality/using-sal-annotations-to-reduce-c-cpp-code-defects.md).
1917

18+
Code analysis name: RETURN_UNINIT_VAR
19+
2020
## Example
2121

2222
The following code generates this warning. This issue stems from the pointer p1 not being set despite having been annotated with ```_Out_```.

0 commit comments

Comments
 (0)