]> granicus.if.org Git - curl/commitdiff
examples: remove superfluous null-pointer checks
authorDaniel Stenberg <daniel@haxx.se>
Thu, 14 Feb 2019 10:48:43 +0000 (11:48 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 14 Feb 2019 22:30:43 +0000 (23:30 +0100)
in ftpget, ftpsget and sftpget, so that scan-build stops warning for
potential NULL pointer dereference below!

Detected by scan-build

docs/examples/ftpget.c
docs/examples/ftpsget.c
docs/examples/sftpget.c

index a2a7da0ce1caf5abab0924b1eb53b84b0701c164..fc7ab4a391a575b237d3660b1a25b2a72f4a63b3 100644 (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
  * 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)
 {
   struct FtpFile *out = (struct FtpFile *)stream;
-  if(out && !out->stream) {
+  if(!out->stream) {
     /* open file for writing */
     out->stream = fopen(out->filename, "wb");
     if(!out->stream)
index fb7489f030539534c04ba371ff44826629398195..91162e6246e6362650daac769b7c0d9a16971c92 100644 (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
  * 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)
 {
   struct FtpFile *out = (struct FtpFile *)stream;
-  if(out && !out->stream) {
+  if(!out->stream) {
     /* open file for writing */
     out->stream = fopen(out->filename, "wb");
     if(!out->stream)
index 44a3caf2ee8e03a6022005bb6140d20078f7eb80..e5a74b9ecdf179b1454e9eaa14de58d4fa558415 100644 (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
  * 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)
 {
   struct FtpFile *out = (struct FtpFile *)stream;
-  if(out && !out->stream) {
+  if(!out->stream) {
     /* open file for writing */
     out->stream = fopen(out->filename, "wb");
     if(!out->stream)