1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-07 08:02:55 +03:00

README.Coding: Add section about pointers

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2017-09-11 17:14:21 +02:00
parent 164cee66ee
commit 72cf2e3ae2

View File

@@ -287,6 +287,27 @@ Good Examples:
return rc;
}
Initialize pointers
-------------------
All pointer variables MUST be initialized to NULL. History has
demonstrated that uninitialized pointer variables have lead to various
bugs and security issues.
Pointers MUST be initialized even if the assignment directly follows
the declaration, like pointer2 in the example below, because the
instructions sequence may change over time.
Good Example:
char *pointer1 = NULL;
char *pointer2 = NULL;
pointer2 = some_func2();
...
pointer1 = some_func1();
Typedefs
---------