Fix bug #3857: Thanks to Zhouyang
[claws.git] / src / plugins / clamd / libclamd / clamd-plugin.c
index c72de83cc60e2a99f5aa123a04dfb942ac66e5c3..6f1cc59e5aecfff3ddf0effbcb0021f596f21ef5 100644 (file)
@@ -324,6 +324,10 @@ static int create_socket() {
                        addr_i.sin_family = AF_INET;
                        addr_i.sin_port = htons(Socket->socket.port);
                        hp = gethostbyname(Socket->socket.host);
+                       if (!hp) {
+                               g_error("fail to get host by: %s", Socket->socket.host);
+                               return new_sock;
+                       }
                        debug_print("IP socket host: %s:%d\n",
                                        Socket->socket.host, Socket->socket.port);
                        bcopy((void *)hp->h_addr, (void *)&addr_i.sin_addr, hp->h_length);