File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -747,19 +747,17 @@ class ArrayBufferOrViewContents {
747747
748748 inline ByteSource ToCopy () const {
749749 if (size () == 0 ) return ByteSource ();
750- char * buf = MallocOpenSSL<char >(size ());
751- CHECK_NOT_NULL (buf);
752- memcpy (buf, data (), size ());
753- return ByteSource::Allocated (buf, size ());
750+ ByteSource::Builder buf (size ());
751+ memcpy (buf.data <void >(), data (), size ());
752+ return std::move (buf).release ();
754753 }
755754
756755 inline ByteSource ToNullTerminatedCopy () const {
757756 if (size () == 0 ) return ByteSource ();
758- char * buf = MallocOpenSSL<char >(size () + 1 );
759- CHECK_NOT_NULL (buf);
760- buf[size ()] = 0 ;
761- memcpy (buf, data (), size ());
762- return ByteSource::Allocated (buf, size ());
757+ ByteSource::Builder buf (size () + 1 );
758+ memcpy (buf.data <char >(), data (), size ());
759+ buf.data <char >()[size ()] = 0 ;
760+ return std::move (buf).release ();
763761 }
764762
765763 template <typename M>
You can’t perform that action at this time.
0 commit comments