]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[apr] scan-build: Fix dereference of a null pointer and unused variable in network_io... 364/head
authorAndrey Volk <andywolk@gmail.com>
Fri, 14 Feb 2020 23:42:51 +0000 (03:42 +0400)
committerAndrey Volk <andywolk@gmail.com>
Fri, 14 Feb 2020 23:49:05 +0000 (03:49 +0400)
libs/apr/network_io/unix/sendrecv.c
libs/apr/network_io/unix/sockets.c

index 9ebc3cf3b4bd10fb75eda4e6da86773bea2edff5..f09a8fdf096bb6a971b1bbd5fab5e052bb45a4f9 100644 (file)
@@ -27,6 +27,8 @@
 #include <osreldate.h>
 #endif
 
+#include <assert.h>     /* assert() */
+
 apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, 
                              apr_size_t *len)
 {
@@ -287,6 +289,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file,
 
     /* Ignore flags for now. */
     flags = 0;
+    assert(flags=0);
 
     if (hdtr->numheaders > 0) {
         apr_size_t hdrbytes;
index 4cff3bbca192e5cb24d193f41afb6fe89a7dbd1b..72dab7b89cf220b426349f29b86f5357ed87087f 100644 (file)
@@ -32,7 +32,11 @@ static apr_status_t socket_cleanup(void *sock)
 {
     apr_socket_t *thesocket = sock;
 
-       if (thesocket && thesocket->socketdes == -1) {
+       if (!thesocket) {
+               return APR_ENOTSOCK;
+       }
+
+       if (thesocket->socketdes == -1) {
                return APR_SUCCESS;
        }