# endif /* LDAP_R_COMPILE */
tm_ptr = gmtime( timep );
- if ( tm_ptr != NULL ) {
+ if ( tm_ptr == NULL ) {
+ result = NULL;
+
+ } else {
*result = *tm_ptr;
}
ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
# endif /* LDAP_R_COMPILE */
- return tm_ptr;
+ return result;
}
#endif /* !USE_GMTIME_R */
# endif /* LDAP_R_COMPILE */
tm_ptr = localtime( timep );
- if ( tm_ptr != NULL ) {
+ if ( tm_ptr == NULL ) {
+ result = NULL;
+
+ } else {
*result = *tm_ptr;
}
ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
# endif /* LDAP_R_COMPILE */
- return tm_ptr;
+ return result;
}
#endif /* !USE_LOCALTIME_R */