lib/ffi/hiredis_vip/set.rb in ffi-hiredis_vip-0.1.0.pre3 vs lib/ffi/hiredis_vip/set.rb in ffi-hiredis_vip-0.1.0.pre4
- old
+ new
@@ -36,17 +36,19 @@
return nil if reply.nil? || reply.null?
case reply[:type]
when :REDIS_REPLY_STRING
- reply[:str]
+ reply[:str].dup
when :REDIS_REPLY_STATUS
- reply[:str]
+ reply[:str].dup
when :REDIS_REPLY_NIL
nil
else
""
end
+ ensure
+ ::FFI::HiredisVip::Core.freeReplyObject(reply.pointer) if reply
end
def setex(key, value, expiry)
set(key, value, :ex => expiry)
end