mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
tests: Fix a clang possible memory leak warning
clang was reporting a possible memory leak after mkdtemp() call, which was a false positive, since mkdtemp() returns the same pointer provided as the parameter, in case of success. This changes the code so that the static analyser don't get confused. Found by csbuild runner. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
c413834764
commit
f427a975b8
@@ -805,11 +805,11 @@ char *torture_make_temp_dir(const char *template)
|
||||
|
||||
new_dir = mkdtemp(template_copy);
|
||||
if (new_dir == NULL) {
|
||||
free(template_copy);
|
||||
SAFE_FREE(template_copy);
|
||||
}
|
||||
|
||||
end:
|
||||
return new_dir;
|
||||
return template_copy;
|
||||
}
|
||||
|
||||
char *torture_create_temp_file(const char *template)
|
||||
|
||||
Reference in New Issue
Block a user