#fixed code
                                private KeyValuePair rdbLoadObject(int rdbtype) throws IOException {
        switch (rdbtype) {
            /*
             * |       <content>       |
             * |    string contents    |
             */
            case RDB_TYPE_STRING:
                KeyStringValueString o0 = new KeyStringValueString();
                EncodedString val = rdbLoadEncodedStringObject();
                o0.setValueRdbType(rdbtype);
                o0.setValue(val.string);
                o0.setRawBytes(val.rawBytes);
                return o0;
            /*
             * |    <len>     |       <content>       |
             * | 1 or 5 bytes |    string contents    |
             */
            case RDB_TYPE_LIST:
                long len = rdbLoadLen().len;
                KeyStringValueList<String> o1 = new KeyStringValueList<>();
                List<String> list = new ArrayList<>();
                for (int i = 0; i < len; i++) {
                    String element = rdbLoadEncodedStringObject().string;
                    list.add(element);
                }
                o1.setValueRdbType(rdbtype);
                o1.setValue(list);
                return o1;
            /*
             * |    <len>     |       <content>       |
             * | 1 or 5 bytes |    string contents    |
             */
            case RDB_TYPE_SET:
                len = rdbLoadLen().len;
                KeyStringValueSet o2 = new KeyStringValueSet();
                Set<String> set = new LinkedHashSet<>();
                for (int i = 0; i < len; i++) {
                    String element = rdbLoadEncodedStringObject().string;
                    set.add(element);
                }
                o2.setValueRdbType(rdbtype);
                o2.setValue(set);
                return o2;
            /*
             * |    <len>     |       <content>       |        <score>       |
             * | 1 or 5 bytes |    string contents    |    double content    |
             */
            case RDB_TYPE_ZSET:
                len = rdbLoadLen().len;
                KeyStringValueZSet o3 = new KeyStringValueZSet();
                Set<ZSetEntry> zset = new LinkedHashSet<>();
                while (len > 0) {
                    String element = rdbLoadEncodedStringObject().string;
                    double score = rdbLoadDoubleValue();
                    zset.add(new ZSetEntry(element, score));
                    len--;
                }
                o3.setValueRdbType(rdbtype);
                o3.setValue(zset);
                return o3;
            /*
             * |    <len>     |       <content>       |        <score>       |
             * | 1 or 5 bytes |    string contents    |    binary double     |
             */
            case RDB_TYPE_ZSET_2:
                /* rdb version 8*/
                len = rdbLoadLen().len;
                KeyStringValueZSet o5 = new KeyStringValueZSet();
                zset = new LinkedHashSet<>();
                while (len > 0) {
                    String element = rdbLoadEncodedStringObject().string;
                    double score = rdbLoadBinaryDoubleValue();
                    zset.add(new ZSetEntry(element, score));
                    len--;
                }
                o5.setValueRdbType(rdbtype);
                o5.setValue(zset);
                return o5;
            /*
             * |    <len>     |       <content>       |
             * | 1 or 5 bytes |    string contents    |
             */
            case RDB_TYPE_HASH:
                len = rdbLoadLen().len;
                KeyStringValueHash o4 = new KeyStringValueHash();
                Map<String, String> map = new LinkedHashMap<>();
                while (len > 0) {
                    String field = rdbLoadEncodedStringObject().string;
                    String value = rdbLoadEncodedStringObject().string;
                    map.put(field, value);
                    len--;
                }
                o4.setValueRdbType(rdbtype);
                o4.setValue(map);
                return o4;
            /*
             * |<zmlen> |   <len>     |"foo"    |    <len>   | <free> |   "bar" |<zmend> |
             * | 1 byte | 1 or 5 byte | content |1 or 5 byte | 1 byte | content | 1 byte |
             */
            case RDB_TYPE_HASH_ZIPMAP:
                ByteArray aux = rdbLoadPlainStringObject();
                RedisInputStream stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueHash o9 = new KeyStringValueHash();
                map = new LinkedHashMap<>();
                int zmlen = BaseRdbParser.LenHelper.zmlen(stream);
                while (true) {
                    int zmEleLen = BaseRdbParser.LenHelper.zmElementLen(stream);
                    if (zmEleLen == 255) {
                        o9.setValueRdbType(rdbtype);
                        o9.setValue(map);
                        return o9;
                    }
                    String field = BaseRdbParser.StringHelper.str(stream, zmEleLen);
                    zmEleLen = BaseRdbParser.LenHelper.zmElementLen(stream);
                    if (zmEleLen == 255) {
                        o9.setValueRdbType(rdbtype);
                        o9.setValue(map);
                        return o9;
                    }
                    int free = BaseRdbParser.LenHelper.free(stream);
                    String value = BaseRdbParser.StringHelper.str(stream, zmEleLen);
                    BaseRdbParser.StringHelper.skip(stream, free);
                    map.put(field, value);
                }
            /*
             * |<encoding>| <length-of-contents>|              <contents>                           |
             * | 4 bytes  |            4 bytes  | 2 bytes lement| 4 bytes element | 8 bytes element |
             */
            case RDB_TYPE_SET_INTSET:
                aux = rdbLoadPlainStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueSet o11 = new KeyStringValueSet();
                set = new LinkedHashSet<>();
                int encoding = BaseRdbParser.LenHelper.encoding(stream);
                int lenOfContent = BaseRdbParser.LenHelper.lenOfContent(stream);
                for (int i = 0; i < lenOfContent; i++) {
                    switch (encoding) {
                        case 2:
                            set.add(String.valueOf(stream.readInt(2)));
                            break;
                        case 4:
                            set.add(String.valueOf(stream.readInt(4)));
                            break;
                        case 8:
                            set.add(String.valueOf(stream.readLong(8)));
                            break;
                        default:
                            throw new AssertionError("Expect encoding [2,4,8] but:" + encoding);
                    }
                }
                o11.setValueRdbType(rdbtype);
                o11.setValue(set);
                return o11;
            /*
             * |<zlbytes>| <zltail>| <zllen>| <entry> ...<entry> | <zlend>|
             * | 4 bytes | 4 bytes | 2bytes | zipListEntry ...   | 1byte  |
             */
            case RDB_TYPE_LIST_ZIPLIST:
                aux = rdbLoadPlainStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueList<String> o10 = new KeyStringValueList<>();
                list = new ArrayList<>();
                int zlbytes = BaseRdbParser.LenHelper.zlbytes(stream);
                int zltail = BaseRdbParser.LenHelper.zltail(stream);
                int zllen = BaseRdbParser.LenHelper.zllen(stream);
                for (int i = 0; i < zllen; i++) {
                    list.add(BaseRdbParser.StringHelper.zipListEntry(stream));
                }
                int zlend = BaseRdbParser.LenHelper.zlend(stream);
                if (zlend != 255) {
                    throw new AssertionError("zlend expected 255 but " + zlend);
                }
                o10.setValueRdbType(rdbtype);
                o10.setValue(list);
                return o10;
            /*
             * |<zlbytes>| <zltail>| <zllen>| <entry> ...<entry> | <zlend>|
             * | 4 bytes | 4 bytes | 2bytes | zipListEntry ...   | 1byte  |
             */
            case RDB_TYPE_ZSET_ZIPLIST:
                aux = rdbLoadPlainStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueZSet o12 = new KeyStringValueZSet();
                zset = new LinkedHashSet<>();
                zlbytes = BaseRdbParser.LenHelper.zlbytes(stream);
                zltail = BaseRdbParser.LenHelper.zltail(stream);
                zllen = BaseRdbParser.LenHelper.zllen(stream);
                while (zllen > 0) {
                    String element = BaseRdbParser.StringHelper.zipListEntry(stream);
                    zllen--;
                    double score = Double.valueOf(BaseRdbParser.StringHelper.zipListEntry(stream));
                    zllen--;
                    zset.add(new ZSetEntry(element, score));
                }
                zlend = BaseRdbParser.LenHelper.zlend(stream);
                if (zlend != 255) {
                    throw new AssertionError("zlend expected 255 but " + zlend);
                }
                o12.setValueRdbType(rdbtype);
                o12.setValue(zset);
                return o12;
            /*
             * |<zlbytes>| <zltail>| <zllen>| <entry> ...<entry> | <zlend>|
             * | 4 bytes | 4 bytes | 2bytes | zipListEntry ...   | 1byte  |
             */
            case RDB_TYPE_HASH_ZIPLIST:
                aux = rdbLoadPlainStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueHash o13 = new KeyStringValueHash();
                map = new LinkedHashMap<>();
                zlbytes = BaseRdbParser.LenHelper.zlbytes(stream);
                zltail = BaseRdbParser.LenHelper.zltail(stream);
                zllen = BaseRdbParser.LenHelper.zllen(stream);
                while (zllen > 0) {
                    String field = BaseRdbParser.StringHelper.zipListEntry(stream);
                    zllen--;
                    String value = BaseRdbParser.StringHelper.zipListEntry(stream);
                    zllen--;
                    map.put(field, value);
                }
                zlend = BaseRdbParser.LenHelper.zlend(stream);
                if (zlend != 255) {
                    throw new AssertionError("zlend expected 255 but " + zlend);
                }
                o13.setValueRdbType(rdbtype);
                o13.setValue(map);
                return o13;
            /* rdb version 7*/
            case RDB_TYPE_LIST_QUICKLIST:
                len = rdbLoadLen().len;
                KeyStringValueList<ByteArray> o14 = new KeyStringValueList<>();
                List<ByteArray> byteList = new ArrayList<>();
                for (int i = 0; i < len; i++) {
                    ByteArray element = (ByteArray) rdbGenericLoadStringObject(RDB_LOAD_NONE);
                    byteList.add(element);
                }
                o14.setValueRdbType(rdbtype);
                o14.setValue(byteList);
                return o14;
            case RDB_TYPE_MODULE:
                /* rdb version 8*/
                //|6|6|6|6|6|6|6|6|6|10|
                char[] c = new char[9];
                long moduleid = rdbLoadLen().len;
                keyStringValueModule o6 = new keyStringValueModule();
                for (int i = 0; i < c.length; i++) {
                    c[i] = MODULE_SET[(int) (moduleid & 63)];
                    moduleid >>>= 6;
                }
                String moduleName = new String(c);
                int moduleVersion = (int) (moduleid & 1023);
                ModuleHandler handler = lookupModuleHandler(moduleName,moduleVersion);
                o6.setValueRdbType(rdbtype);
                o6.setValue(handler.rdbLoad(in));
                return o6;
            default:
                throw new AssertionError("Un-except value-type:" + rdbtype);

        }
    }
#vulnerable code 
                                private KeyValuePair rdbLoadObject(int rdbtype) throws IOException {
        switch (rdbtype) {
            /*
             * |       <content>       |
             * |    string contents    |
             */
            case REDIS_RDB_TYPE_STRING:
                KeyStringValueString o0 = new KeyStringValueString();
                EncodedString val = rdbLoadEncodedStringObject();
                o0.setValueRdbType(rdbtype);
                o0.setValue(val.string);
                o0.setRawBytes(val.rawBytes);
                return o0;
            /*
             * |    <len>     |       <content>       |
             * | 1 or 5 bytes |    string contents    |
             */
            case REDIS_RDB_TYPE_LIST:
                long len = rdbLoadLen().len;
                KeyStringValueList<String> o1 = new KeyStringValueList<>();
                List<String> list = new ArrayList<>();
                for (int i = 0; i < len; i++) {
                    String element = rdbLoadEncodedStringObject().string;
                    list.add(element);
                }
                o1.setValueRdbType(rdbtype);
                o1.setValue(list);
                return o1;
            /*
             * |    <len>     |       <content>       |
             * | 1 or 5 bytes |    string contents    |
             */
            case REDIS_RDB_TYPE_SET:
                len = rdbLoadLen().len;
                KeyStringValueSet o2 = new KeyStringValueSet();
                Set<String> set = new LinkedHashSet<>();
                for (int i = 0; i < len; i++) {
                    String element = rdbLoadEncodedStringObject().string;
                    set.add(element);
                }
                o2.setValueRdbType(rdbtype);
                o2.setValue(set);
                return o2;
            /*
             * |    <len>     |       <content>       |        <score>       |
             * | 1 or 5 bytes |    string contents    |    double content    |
             */
            case REDIS_RDB_TYPE_ZSET:
                len = rdbLoadLen().len;
                KeyStringValueZSet o3 = new KeyStringValueZSet();
                Set<ZSetEntry> zset = new LinkedHashSet<>();
                while (len > 0) {
                    String element = rdbLoadEncodedStringObject().string;
                    double score = rdbLoadDoubleValue();
                    zset.add(new ZSetEntry(element, score));
                    len--;
                }
                o3.setValueRdbType(rdbtype);
                o3.setValue(zset);
                return o3;
            /*
             * |    <len>     |       <content>       |        <score>       |
             * | 1 or 5 bytes |    string contents    |    binary double     |
             */
            case REDIS_RDB_TYPE_ZSET_2:
                /* rdb version 8*/
                len = rdbLoadLen().len;
                KeyStringValueZSet o5 = new KeyStringValueZSet();
                zset = new LinkedHashSet<>();
                while (len > 0) {
                    String element = rdbLoadEncodedStringObject().string;
                    double score = rdbLoadBinaryDoubleValue();
                    zset.add(new ZSetEntry(element, score));
                    len--;
                }
                o5.setValueRdbType(rdbtype);
                o5.setValue(zset);
                return o5;
            /*
             * |    <len>     |       <content>       |
             * | 1 or 5 bytes |    string contents    |
             */
            case REDIS_RDB_TYPE_HASH:
                len = rdbLoadLen().len;
                KeyStringValueHash o4 = new KeyStringValueHash();
                Map<String, String> map = new LinkedHashMap<>();
                while (len > 0) {
                    String field = rdbLoadEncodedStringObject().string;
                    String value = rdbLoadEncodedStringObject().string;
                    map.put(field, value);
                    len--;
                }
                o4.setValueRdbType(rdbtype);
                o4.setValue(map);
                return o4;
            /*
             * |<zmlen> |   <len>     |"foo"    |    <len>   | <free> |   "bar" |<zmend> |
             * | 1 byte | 1 or 5 byte | content |1 or 5 byte | 1 byte | content | 1 byte |
             */
            case REDIS_RDB_TYPE_HASH_ZIPMAP:
                ByteArray aux = rdbLoadRawStringObject();
                RedisInputStream stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueHash o9 = new KeyStringValueHash();
                map = new LinkedHashMap<>();
                int zmlen = BaseRdbParser.LenHelper.zmlen(stream);
                while (true) {
                    int zmEleLen = BaseRdbParser.LenHelper.zmElementLen(stream);
                    if (zmEleLen == 255) {
                        o9.setValueRdbType(rdbtype);
                        o9.setValue(map);
                        return o9;
                    }
                    String field = BaseRdbParser.StringHelper.str(stream, zmEleLen);
                    zmEleLen = BaseRdbParser.LenHelper.zmElementLen(stream);
                    if (zmEleLen == 255) {
                        o9.setValueRdbType(rdbtype);
                        o9.setValue(map);
                        return o9;
                    }
                    int free = BaseRdbParser.LenHelper.free(stream);
                    String value = BaseRdbParser.StringHelper.str(stream, zmEleLen);
                    BaseRdbParser.StringHelper.skip(stream, free);
                    map.put(field, value);
                }
            /*
             * |<encoding>| <length-of-contents>|              <contents>                           |
             * | 4 bytes  |            4 bytes  | 2 bytes lement| 4 bytes element | 8 bytes element |
             */
            case REDIS_RDB_TYPE_SET_INTSET:
                aux = rdbLoadRawStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueSet o11 = new KeyStringValueSet();
                set = new LinkedHashSet<>();
                int encoding = BaseRdbParser.LenHelper.encoding(stream);
                int lenOfContent = BaseRdbParser.LenHelper.lenOfContent(stream);
                for (int i = 0; i < lenOfContent; i++) {
                    switch (encoding) {
                        case 2:
                            set.add(String.valueOf(stream.readInt(2)));
                            break;
                        case 4:
                            set.add(String.valueOf(stream.readInt(4)));
                            break;
                        case 8:
                            set.add(String.valueOf(stream.readLong(8)));
                            break;
                        default:
                            throw new AssertionError("Expect encoding [2,4,8] but:" + encoding);
                    }
                }
                o11.setValueRdbType(rdbtype);
                o11.setValue(set);
                return o11;
            /*
             * |<zlbytes>| <zltail>| <zllen>| <entry> ...<entry> | <zlend>|
             * | 4 bytes | 4 bytes | 2bytes | zipListEntry ...   | 1byte  |
             */
            case REDIS_RDB_TYPE_LIST_ZIPLIST:
                aux = rdbLoadRawStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueList<String> o10 = new KeyStringValueList<>();
                list = new ArrayList<>();
                int zlbytes = BaseRdbParser.LenHelper.zlbytes(stream);
                int zltail = BaseRdbParser.LenHelper.zltail(stream);
                int zllen = BaseRdbParser.LenHelper.zllen(stream);
                for (int i = 0; i < zllen; i++) {
                    list.add(BaseRdbParser.StringHelper.zipListEntry(stream));
                }
                int zlend = BaseRdbParser.LenHelper.zlend(stream);
                if (zlend != 255) {
                    throw new AssertionError("zlend expected 255 but " + zlend);
                }
                o10.setValueRdbType(rdbtype);
                o10.setValue(list);
                return o10;
            /*
             * |<zlbytes>| <zltail>| <zllen>| <entry> ...<entry> | <zlend>|
             * | 4 bytes | 4 bytes | 2bytes | zipListEntry ...   | 1byte  |
             */
            case REDIS_RDB_TYPE_ZSET_ZIPLIST:
                aux = rdbLoadRawStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueZSet o12 = new KeyStringValueZSet();
                zset = new LinkedHashSet<>();
                zlbytes = BaseRdbParser.LenHelper.zlbytes(stream);
                zltail = BaseRdbParser.LenHelper.zltail(stream);
                zllen = BaseRdbParser.LenHelper.zllen(stream);
                while (zllen > 0) {
                    String element = BaseRdbParser.StringHelper.zipListEntry(stream);
                    zllen--;
                    double score = Double.valueOf(BaseRdbParser.StringHelper.zipListEntry(stream));
                    zllen--;
                    zset.add(new ZSetEntry(element, score));
                }
                zlend = BaseRdbParser.LenHelper.zlend(stream);
                if (zlend != 255) {
                    throw new AssertionError("zlend expected 255 but " + zlend);
                }
                o12.setValueRdbType(rdbtype);
                o12.setValue(zset);
                return o12;
            /*
             * |<zlbytes>| <zltail>| <zllen>| <entry> ...<entry> | <zlend>|
             * | 4 bytes | 4 bytes | 2bytes | zipListEntry ...   | 1byte  |
             */
            case REDIS_RDB_TYPE_HASH_ZIPLIST:
                aux = rdbLoadRawStringObject();
                stream = new RedisInputStream(new ByteArrayInputStream(aux));
                KeyStringValueHash o13 = new KeyStringValueHash();
                map = new LinkedHashMap<>();
                zlbytes = BaseRdbParser.LenHelper.zlbytes(stream);
                zltail = BaseRdbParser.LenHelper.zltail(stream);
                zllen = BaseRdbParser.LenHelper.zllen(stream);
                while (zllen > 0) {
                    String field = BaseRdbParser.StringHelper.zipListEntry(stream);
                    zllen--;
                    String value = BaseRdbParser.StringHelper.zipListEntry(stream);
                    zllen--;
                    map.put(field, value);
                }
                zlend = BaseRdbParser.LenHelper.zlend(stream);
                if (zlend != 255) {
                    throw new AssertionError("zlend expected 255 but " + zlend);
                }
                o13.setValueRdbType(rdbtype);
                o13.setValue(map);
                return o13;
            /* rdb version 7*/
            case REDIS_RDB_TYPE_LIST_QUICKLIST:
                len = rdbLoadLen().len;
                KeyStringValueList<ByteArray> o14 = new KeyStringValueList<>();
                List<ByteArray> byteList = new ArrayList<>();
                for (int i = 0; i < len; i++) {
                    ByteArray element = rdbLoadRawStringObject();
                    byteList.add(element);
                }
                o14.setValueRdbType(rdbtype);
                o14.setValue(byteList);
                return o14;
            case REDIS_RDB_TYPE_MODULE:
                /* rdb version 8*/
                //|6|6|6|6|6|6|6|6|6|10|
                char[] c = new char[9];
                long moduleid = rdbLoadLen().len;
                keyStringValueModule o6 = new keyStringValueModule();
                for (int i = 0; i < c.length; i++) {
                    c[i] = MODULE_SET[(int) (moduleid & 63)];
                    moduleid >>>= 6;
                }
                String moduleName = new String(c);
                int moduleVersion = (int) (moduleid & 1023);
                ModuleHandler handler = lookupModuleHandler(moduleName,moduleVersion);
                o6.setValueRdbType(rdbtype);
                o6.setValue(handler.rdbLoad(in));
                return o6;
            default:
                throw new AssertionError("Un-except value-type:" + rdbtype);

        }
    } 
                            #location 109 
                            #vulnerability type RESOURCE_LEAK