diff options
author | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2018-11-29 13:22:59 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-11-30 18:28:40 +0100 |
commit | f427a975b8a4b2aee2ba0c37e28d6ebbf84c67fb (patch) | |
tree | 2de1cc049ec9b3348cd34caf01e367ec5018ca88 | |
parent | c413834764707df1316790d4182aea4135589108 (diff) | |
download | libssh-f427a975b8a4b2aee2ba0c37e28d6ebbf84c67fb.tar.gz libssh-f427a975b8a4b2aee2ba0c37e28d6ebbf84c67fb.tar.xz libssh-f427a975b8a4b2aee2ba0c37e28d6ebbf84c67fb.zip |
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>
-rw-r--r-- | tests/torture.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/torture.c b/tests/torture.c index 88387edb..3500cd50 100644 --- a/tests/torture.c +++ b/tests/torture.c @@ -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) |