From de7bb00b0c877c5895341c28e01ae6408df2a06c Mon Sep 17 00:00:00 2001 From: wwp Date: Wed, 11 Jan 2017 16:09:08 +0100 Subject: [PATCH 1/1] Quit function if no connection instead of assigning variable that will be overwriten right after. Fixes Coverity CID #1372370. --- src/plugins/clamd/libclamd/clamd-plugin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c index a45860a9b..8152d1dfd 100644 --- a/src/plugins/clamd/libclamd/clamd-plugin.c +++ b/src/plugins/clamd/libclamd/clamd-plugin.c @@ -513,7 +513,7 @@ Clamd_Stat clamd_verify_email(const gchar* path, response* result) { } sock = create_socket(); if (sock < 0) { - debug_print("no connection\n"); + debug_print("no connection (socket create)\n"); return NO_CONNECTION; } memset(buf, '\0', sizeof(buf)); @@ -535,8 +535,8 @@ Clamd_Stat clamd_verify_email(const gchar* path, response* result) { command = g_strconcat(scan, " ", path, "\n", NULL); debug_print("command: %s\n", command); if (write(sock, command, strlen(command)) == -1) { - debug_print("no connection\n"); - stat = NO_CONNECTION; + debug_print("no connection (socket write)\n"); + return NO_CONNECTION; } g_free(command); memset(buf, '\0', sizeof(buf)); -- 2.25.1