[codec-memcache] Avoid memory leak when encoding the key