This looks suspiciously like you're fixing the wrong mistake; we need to find out what the original author intended, e.g. did they intend to clear the key from memory, as memset(key, 0, ksize); and similarly for value ?  Setting the pointers and sizes to NULL and 0 serves no purpose, at least: I'm fairly sure NextDB() over-writes whatever values they get.  My trawl through the history of these lines suggests that someone merely forgot to remove them when the types used for key and value got changed !  So I think simply removing the lines would be better.