On Mon, Aug 13 2018, Scott Cheloha <[email protected]> wrote:
> tb@ spotted this one.
>
> If BIO_new fails we leak scon, so SSL_free it in that case.
>
> ok?
Alternative proposal: let doConnection() and benchmark() free the
resources they allocated respectively.
Index: s_time.c
===================================================================
RCS file: /d/cvs/src/usr.bin/openssl/s_time.c,v
retrieving revision 1.25
diff -u -p -p -u -r1.25 s_time.c
--- s_time.c 11 Aug 2018 16:07:36 -0000 1.25
+++ s_time.c 13 Aug 2018 16:50:23 -0000
@@ -414,7 +414,7 @@ benchmark(int reuse_session)
{
double totalTime = 0.0;
int nConn = 0;
- SSL *scon = NULL;
+ SSL *scon = NULL, *newcon;
time_t finishtime;
int ret = 1;
char buf[1024 * 8];
@@ -455,8 +455,10 @@ benchmark(int reuse_session)
for (;;) {
if (finishtime < time(NULL))
break;
- if ((scon = doConnection(reuse_session ? scon : NULL)) == NULL)
+ newcon = doConnection(reuse_session ? scon : NULL);
+ if (newcon == NULL)
goto end;
+ scon = newcon;
if (s_time_config.www_path != NULL) {
int i, retval = snprintf(buf, sizeof buf,
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE