rpc_read_from_socket: fix use-after-free due to missing return
authorArne Redlich <arne.redlich@googlemail.com>
Tue, 18 Feb 2014 19:22:11 +0000 (20:22 +0100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 20 Feb 2014 02:59:44 +0000 (18:59 -0800)
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
lib/socket.c

index 037fbbef5f51ce0c3038c96e2a327c822149bf24..055109a73c9f7b4be1f69d73f0552feb5c2d51ff 100644 (file)
@@ -210,6 +210,7 @@ static int rpc_read_from_socket(struct rpc_context *rpc)
                if (count < 0) {
                        rpc_set_error(rpc, "Failed recvfrom: %s", strerror(errno));
                        free(buf);
+                       return -1;
                }
                if (rpc_process_pdu(rpc, buf, count) != 0) {
                        rpc_set_error(rpc, "Invalid/garbage pdu received from server. Ignoring PDU");