diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2006-04-13 22:12:45 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2006-04-13 22:12:45 +0000 |
commit | a2b0e82764ea9c25f461ea750c9169bca9c6bf51 (patch) | |
tree | 920e1708e44d3ec0d6daebb6736e8e05cac25d3f /usr.sbin/httpd | |
parent | 87f779dbb1cf26ee25a172b2e6b458dea26e874c (diff) |
Fix pr 5073, httpd/mod_ssl can leak file descriptors in the
case where an ssl connection is not found in the scache dbm
Reported by, and fix suggested by
Darrin Chandler <darrin@puffy.asicommunications.com>
testing by me, ok henning@
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r-- | usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c b/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c index 808208cab47..78703958800 100644 --- a/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c +++ b/usr.sbin/httpd/src/modules/ssl/ssl_scache_dbm.c @@ -230,14 +230,18 @@ SSL_SESSION *ssl_scache_dbm_retrieve(server_rec *s, UCHAR *id, int idlen) ssl_mutex_off(s); /* immediately return if not found */ - if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(time_t)) + if (dbmval.dptr == NULL || dbmval.dsize <= sizeof(time_t)) { + ssl_dbm_close(dbm); return NULL; + } /* parse resulting data */ nData = dbmval.dsize-sizeof(time_t); ucpData = (UCHAR *)malloc(nData); - if (ucpData == NULL) + if (ucpData == NULL) { + ssl_dbm_close(dbm); return NULL; + } memcpy(ucpData, (char *)dbmval.dptr+sizeof(time_t), nData); memcpy(&expiry, dbmval.dptr, sizeof(time_t)); |