[apr] scan-build: Fix dereference of a null pointer and unused variable in network_io/unix

This commit is contained in:
Andrey Volk 2020-02-15 03:42:51 +04:00
parent fb9f7aa170
commit df52479eb4
2 changed files with 8 additions and 1 deletions

View 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;

View 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;
}