]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lint: daemon/io.c: avoided Null pointer for output stream
authorAleš Mrázek <ales.mrazek@nic.cz>
Fri, 22 Aug 2025 11:36:34 +0000 (13:36 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 27 Aug 2025 06:57:15 +0000 (08:57 +0200)
If it is not checked, the clang-tidy clang-analyzer-core::NonNullParamChecker error will be raised.

daemon/io.c

index fa99ac036f81cfee411edab7e5e872f3266523b5..79a586b24583dc8204d2c332a5ab6b9703766b97 100644 (file)
@@ -567,6 +567,11 @@ void io_tty_process_input(uv_stream_t *stream, ssize_t nread, const uv_buf_t *bu
                }
        }
 
+       /* Avoid Null pointer */
+       if (!out) {
+               return;
+       }
+
        /** The current single command and the remaining command(s). */
        char *cmd, *cmd_next = NULL;
        bool incomplete_cmd = false;