1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-10-24 03:48:58 +03:00

src: add SSH2_SAFEFREE() macro and use it

Like `SSH2_FREE()` but also assign `NULL` to the freed pointer variable.

Also add checksrc rule to verify.

Ref: #2208

Closes #2209
This commit is contained in:
Viktor Szakats
2026-07-04 17:26:36 +02:00
parent d152c13e6a
commit 2e7c9a0975
16 changed files with 273 additions and 538 deletions

View File

@@ -988,6 +988,10 @@ sub scanfile {
$prevfreeindent = $1;
$prevfreevar = $2;
}
elsif($l =~ /^( *)SSH2_FREE\(([^)]+), ([^)]+)\);/) {
$prevfreeindent = $1;
$prevfreevar = $3;
}
else {
$prevfreeindent = "";
$prevfreevar = "";