1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

examples: remove superfluous null-pointer checks

in ftpget, ftpsget and sftpget, so that scan-build stops warning for
potential NULL pointer dereference below!

Detected by scan-build
This commit is contained in:
Daniel Stenberg 2019-02-14 11:48:43 +01:00
parent 354aa32820
commit b4beb3b115
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -36,7 +36,7 @@ struct FtpFile {
static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream)
{ {
struct FtpFile *out = (struct FtpFile *)stream; struct FtpFile *out = (struct FtpFile *)stream;
if(out && !out->stream) { if(!out->stream) {
/* open file for writing */ /* open file for writing */
out->stream = fopen(out->filename, "wb"); out->stream = fopen(out->filename, "wb");
if(!out->stream) if(!out->stream)

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2015, 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -38,7 +38,7 @@ static size_t my_fwrite(void *buffer, size_t size, size_t nmemb,
void *stream) void *stream)
{ {
struct FtpFile *out = (struct FtpFile *)stream; struct FtpFile *out = (struct FtpFile *)stream;
if(out && !out->stream) { if(!out->stream) {
/* open file for writing */ /* open file for writing */
out->stream = fopen(out->filename, "wb"); out->stream = fopen(out->filename, "wb");
if(!out->stream) if(!out->stream)

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -47,7 +47,7 @@ static size_t my_fwrite(void *buffer, size_t size, size_t nmemb,
void *stream) void *stream)
{ {
struct FtpFile *out = (struct FtpFile *)stream; struct FtpFile *out = (struct FtpFile *)stream;
if(out && !out->stream) { if(!out->stream) {
/* open file for writing */ /* open file for writing */
out->stream = fopen(out->filename, "wb"); out->stream = fopen(out->filename, "wb");
if(!out->stream) if(!out->stream)