Project

General

Profile

Feature #14426 » openssl-memory-allocation.patch

janko (Janko Marohnić), 07/07/2018 05:04 PM

View differences:

ext/openssl/lib/openssl/buffering.rb
316 316
    @wbuffer << s
317 317
    @wbuffer.force_encoding(Encoding::BINARY)
318 318
    @sync ||= false
319
    if @sync or @wbuffer.size > BLOCK_SIZE or idx = @wbuffer.rindex("\n")
320
      remain = idx ? idx + 1 : @wbuffer.size
321
      nwritten = 0
322
      while remain > 0
323
        str = @wbuffer[nwritten,remain]
319
    if @sync or @wbuffer.size > BLOCK_SIZE
320
      until @wbuffer.empty?
324 321
        begin
325
          nwrote = syswrite(str)
322
          nwrote = syswrite(@wbuffer)
326 323
        rescue Errno::EAGAIN
327 324
          retry
328 325
        end
329
        remain -= nwrote
330
        nwritten += nwrote
326
        @wbuffer[0, nwrote] = ""
331 327
      end
332
      @wbuffer[0,nwritten] = ""
333 328
    end
334 329
  end
335 330