tstream: Fix CID 1167981 Unchecked return value
[samba.git] / libcli / smb / tstream_smbXcli_np.c
index af0863e50bb65593450cdca095a6fa7c2e3e3157..8dfc4fb2466a1ad1b1879c9a92d64c1a37c93b50 100644 (file)
@@ -111,7 +111,11 @@ static int tstream_smbXcli_np_destructor(struct tstream_smbXcli_np *cli_nps)
         * Once we've fixed all callers to call
         * tstream_disconnect_send()/_recv(), this will
         * never be called.
+        *
+        * We use a maximun timeout of 1 second == 1000 msec.
         */
+       cli_nps->timeout = MIN(cli_nps->timeout, 1000);
+
        if (cli_nps->is_smb1) {
                status = smb1cli_close(cli_nps->conn,
                                       cli_nps->timeout,
@@ -1006,7 +1010,7 @@ static void tstream_smbXcli_np_readv_trans_done(struct tevent_req *subreq)
        cli_nps->read.buf = talloc_array(cli_nps, uint8_t, received);
        if (cli_nps->read.buf == NULL) {
                TALLOC_FREE(subreq);
-               tevent_req_nomem(cli_nps->read.buf, req);
+               tevent_req_oom(req);
                return;
        }
        memcpy(cli_nps->read.buf, rcvbuf, received);
@@ -1092,7 +1096,7 @@ static void tstream_smbXcli_np_readv_read_done(struct tevent_req *subreq)
        cli_nps->read.buf = talloc_array(cli_nps, uint8_t, received);
        if (cli_nps->read.buf == NULL) {
                TALLOC_FREE(subreq);
-               tevent_req_nomem(cli_nps->read.buf, req);
+               tevent_req_oom(req);
                return;
        }
        memcpy(cli_nps->read.buf, rcvbuf, received);