@@ -414,7 +414,7 @@ SObj tls_connection_create(Timeout *t,
414414 static_cast <br_ssl_client_context *>(
415415 heap_allocate (t, allocator, sizeof (br_ssl_client_context))),
416416 deleter};
417- if (clientContext == nullptr )
417+ if (!Capability{ clientContext. get ()}. is_valid () )
418418 {
419419 Debug::log (" Failed to allocate client context" );
420420 return nullptr ;
@@ -424,7 +424,7 @@ SObj tls_connection_create(Timeout *t,
424424 heap_allocate (t, allocator, sizeof (br_x509_minimal_context))),
425425 deleter};
426426 auto *engine = &clientContext->eng ;
427- if (x509Context == nullptr )
427+ if (!Capability{ x509Context. get ()}. is_valid () )
428428 {
429429 Debug::log (" Failed to allocate X509 context" );
430430 return nullptr ;
@@ -442,7 +442,8 @@ SObj tls_connection_create(Timeout *t,
442442 static_cast <unsigned char *>(
443443 heap_allocate (t, allocator, MinimumBufferSize)),
444444 deleter};
445- if (iobufIn == nullptr || iobufOut == nullptr )
445+ if (!Capability{iobufIn.get ()}.is_valid () ||
446+ !Capability{iobufOut.get ()}.is_valid ())
446447 {
447448 Debug::log (" Failed to allocate buffers" );
448449 return nullptr ;
@@ -638,7 +639,7 @@ NetworkReceiveResult tls_connection_receive(Timeout *t, SObj sealedConnection)
638639 heap_allocate (&zeroTimeout, mallocCapability, available));
639640 t->elapse (zeroTimeout.elapsed );
640641
641- if (buffer == nullptr )
642+ if (!Capability{ buffer}. is_valid () )
642643 {
643644 // If there's a lot of data, just try a small
644645 // allocation and see if that works.
@@ -667,7 +668,7 @@ NetworkReceiveResult tls_connection_receive(Timeout *t, SObj sealedConnection)
667668 available = -ENOMEM;
668669 return nullptr ;
669670 }
670- } while (buffer == nullptr );
671+ } while (!Capability{ buffer}. is_valid () );
671672 return buffer;
672673 });
673674 return {result, buffer};
0 commit comments