19c6d7c21Sopenharmony_ci/*
29c6d7c21Sopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd.
39c6d7c21Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49c6d7c21Sopenharmony_ci * you may not use this file except in compliance with the License.
59c6d7c21Sopenharmony_ci * You may obtain a copy of the License at
69c6d7c21Sopenharmony_ci *
79c6d7c21Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89c6d7c21Sopenharmony_ci *
99c6d7c21Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109c6d7c21Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119c6d7c21Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129c6d7c21Sopenharmony_ci * See the License for the specific language governing permissions and
139c6d7c21Sopenharmony_ci * limitations under the License.
149c6d7c21Sopenharmony_ci */
159c6d7c21Sopenharmony_ci#include "memory_adapter.h"
169c6d7c21Sopenharmony_ci#include <malloc.h>
179c6d7c21Sopenharmony_ci
189c6d7c21Sopenharmony_civoid *SAMGR_Malloc(uint32 size)
199c6d7c21Sopenharmony_ci{
209c6d7c21Sopenharmony_ci    if (size == 0) {
219c6d7c21Sopenharmony_ci        return NULL;
229c6d7c21Sopenharmony_ci    }
239c6d7c21Sopenharmony_ci    return malloc(size);
249c6d7c21Sopenharmony_ci}
259c6d7c21Sopenharmony_ci
269c6d7c21Sopenharmony_civoid SAMGR_Free(void *buffer)
279c6d7c21Sopenharmony_ci{
289c6d7c21Sopenharmony_ci    if (buffer == NULL) {
299c6d7c21Sopenharmony_ci        return;
309c6d7c21Sopenharmony_ci    }
319c6d7c21Sopenharmony_ci    (void)free(buffer);
329c6d7c21Sopenharmony_ci}