1 /* 2 * Copyright 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef BT_STACK_FUZZ_A2DP_CODEC_HELPERS_H_ 18 #define BT_STACK_FUZZ_A2DP_CODEC_HELPERS_H_ 19 20 // NOTE: This file should not be included directly. 21 // It is included by the corresponding "...Functions.h" file. 22 23 #include <fuzzer/FuzzedDataProvider.h> 24 25 #include <vector> 26 27 #include "a2dp_codec_api.h" 28 #include "fuzzers/a2dp/codec/a2dpCodecInfoFuzzHelpers.h" 29 30 // Keep a vector of any allocated A2dpCodecs objects. 31 // It will be up to the caller to free this array at the end of a fuzz loop 32 std::vector<std::shared_ptr<A2dpCodecs>> a2dp_codecs_vect; 33 34 uint16_t a2dp_init_runs = 0; 35 36 // Function to clean up and clear our allocated objects cleanupA2dpCodecFuzz()37void cleanupA2dpCodecFuzz() { 38 // Clean up our vector 39 a2dp_codecs_vect.clear(); 40 41 // Reset the number of times we've called init 42 a2dp_init_runs = 0; 43 44 // Clean up dependencies 45 cleanupA2dpCodecInfoFuzz(); 46 } 47 48 #endif // BT_STACK_FUZZ_A2DP_CODEC_HELPERS_H_ 49