Method: FFI::Pointer#read_win32_local_pointer

Defined in:
lib/puppet/ffi/windows/api_types.rb

#read_win32_local_pointer(&block) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/puppet/ffi/windows/api_types.rb', line 94

def read_win32_local_pointer(&block)
  ptr = read_pointer
  begin
    yield ptr
  ensure
    if !ptr.null? && FFI::WIN32::LocalFree(ptr.address) != FFI::Pointer::NULL_HANDLE
      Puppet.debug "LocalFree memory leak"
    end
  end

  # ptr has already had LocalFree called, so nothing to return
  nil
end