ldap_server: Fix CID 1435721 Unchecked return value
authorVolker Lendecke <vl@samba.org>
Tue, 22 May 2018 15:10:07 +0000 (17:10 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 24 May 2018 01:35:00 +0000 (03:35 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May 24 03:35:00 CEST 2018 on sn-devel-144

source4/ldap_server/ldap_server.c

index 49e03ef8c6f9c17e1267989ad696a382d6ecb444..b5251e3623e8536493c95698ff477fed88e32c36 100644 (file)
@@ -104,6 +104,7 @@ static void ldapsrv_terminate_connection_done(struct tevent_req *subreq)
                tevent_req_callback_data(subreq,
                struct ldapsrv_connection);
        int sys_errno;
+       bool ok;
 
        tstream_disconnect_recv(subreq, &sys_errno);
        TALLOC_FREE(subreq);
@@ -130,9 +131,15 @@ static void ldapsrv_terminate_connection_done(struct tevent_req *subreq)
                                            conn->limits.reason);
                return;
        }
-       tevent_req_set_endtime(subreq,
-                              conn->connection->event.ctx,
-                              conn->limits.endtime);
+       ok = tevent_req_set_endtime(subreq,
+                                   conn->connection->event.ctx,
+                                   conn->limits.endtime);
+       if (!ok) {
+               TALLOC_FREE(conn->sockets.raw);
+               stream_terminate_connection(conn->connection,
+                                           conn->limits.reason);
+               return;
+       }
        tevent_req_set_callback(subreq, ldapsrv_terminate_connection_done, conn);
 }