diff --git a/uhdf2/manager/src/servstat_listener_holder.c b/uhdf2/manager/src/servstat_listener_holder.c index 52928d519b20d9e4e6189b97620f15be589b896e..cedf2f35ee4c1f5fcbed86e31a69ef3bbf11e3e5 100644 --- a/uhdf2/manager/src/servstat_listener_holder.c +++ b/uhdf2/manager/src/servstat_listener_holder.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +33,16 @@ struct SvcStatListenerHolderList { bool inited; }; -static struct SvcStatListenerHolderList g_holoderList = { 0 }; +static struct SvcStatListenerHolderList g_holoderList = { + .mutex = { + .realMutex = NULL, + }, + .list = { + .prev = NULL, + .next = NULL, + }, + .inited = false, +}; static void UServStatListenerHolderListInit(void) { @@ -86,13 +95,13 @@ int32_t UServStatListenerHolderNotifyStatus(struct ServStatListenerHolder *holde SERVIE_STATUS_LISTENER_NOTIFY, data, NULL); if (ret != HDF_SUCCESS) { HDF_LOGE("failed to notify service status, dispatch error"); + HdfSbufRecycle(data); return HDF_FAILURE; } else { HDF_LOGD("notify service status success"); + HdfSbufRecycle(data); return HDF_SUCCESS; } - HdfSbufRecycle(data); - return HDF_SUCCESS; } void UServStatListenerHolderRecycle(struct ServStatListenerHolder *holder)