]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/os-ip.c
Timeouts should not be malloc'd
[openldap] / libraries / libldap / os-ip.c
index ecd4e831c78b9cf7f82f4e7cc15bcf3a4df547bd..4b7de9e690f362c5b72c7c56b3a777f6d315e48a 100644 (file)
@@ -354,8 +354,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
        int async)
 {
        int rc, err;
-       struct timeval  tv = { 0 },
-                       *opt_tv = NULL;
+       struct timeval  tv, *opt_tv = NULL;
 
 #ifdef LDAP_CONNECTIONLESS
        /* We could do a connect() but that would interfere with
@@ -369,9 +368,9 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
                return ( 0 );
        }
 #endif
-       opt_tv = ld->ld_options.ldo_tm_net;
-       if ( opt_tv != NULL ) {
-               tv = *opt_tv;
+       if ( ld->ld_options.ldo_tm_net.tv_sec >= 0 ) {
+               tv = ld->ld_options.ldo_tm_net;
+               opt_tv = &tv;
        }
 
        osip_debug(ld, "ldap_pvt_connect: fd: %d tm: %ld async: %d\n",