mirror of
https://gitee.com/openharmony/drivers_framework
synced 2025-02-21 14:31:26 +00:00
!11 fix: resolve the memory free problem of the service status notification module
Merge pull request !11 from Zhang/OpenHarmony-3.2-Beta1
This commit is contained in:
commit
db20ee2467
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
*
|
||||
* HDF is dual licensed: you can use it either under the terms of
|
||||
* the GPL, or the BSD license, at your option.
|
||||
@ -62,6 +62,7 @@ int32_t KServStatListenerHolderNotifyStatus(struct ServStatListenerHolder *holde
|
||||
|
||||
if (HdfDeviceSendEventToClient(holderInst->listenerClient, 0, data) != HDF_SUCCESS) {
|
||||
HDF_LOGE("failed to notify service status, send error");
|
||||
HdfSbufRecycle(data);
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
*
|
||||
* HDF is dual licensed: you can use it either under the terms of
|
||||
* the GPL, or the BSD license, at your option.
|
||||
@ -31,10 +31,13 @@ static int32_t SetListenClass(struct SvcMgrIoservice *svcmgrInst, uint16_t devCl
|
||||
(void)HdfSbufWriteUint16(data, devClass);
|
||||
if (svcmgrInst->iosvc == NULL || svcmgrInst->iosvc->dispatcher == NULL
|
||||
|| svcmgrInst->iosvc->dispatcher->Dispatch == NULL) {
|
||||
HdfSbufRecycle(data);
|
||||
return HDF_ERR_INVALID_OBJECT;
|
||||
}
|
||||
return svcmgrInst->iosvc->dispatcher->Dispatch(
|
||||
int32_t ret = svcmgrInst->iosvc->dispatcher->Dispatch(
|
||||
(struct HdfObject *)svcmgrInst->iosvc, SVCMGR_REGISTER_LISTENER, data, NULL);
|
||||
HdfSbufRecycle(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int32_t UnSetListenClass(struct SvcMgrIoservice *svcmgrInst, uint16_t devClass)
|
||||
@ -47,10 +50,13 @@ static int32_t UnSetListenClass(struct SvcMgrIoservice *svcmgrInst, uint16_t dev
|
||||
(void)HdfSbufWriteUint16(data, devClass);
|
||||
if (svcmgrInst->iosvc == NULL || svcmgrInst->iosvc->dispatcher == NULL
|
||||
|| svcmgrInst->iosvc->dispatcher->Dispatch == NULL) {
|
||||
HdfSbufRecycle(data);
|
||||
return HDF_ERR_INVALID_OBJECT;
|
||||
}
|
||||
return svcmgrInst->iosvc->dispatcher->Dispatch(
|
||||
int32_t ret = svcmgrInst->iosvc->dispatcher->Dispatch(
|
||||
(struct HdfObject *)svcmgrInst->iosvc, SVCMGR_UNREGISTER_LISTENER, data, NULL);
|
||||
HdfSbufRecycle(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t SvcMgrIoserviceRegSvcStatListener(
|
||||
|
Loading…
x
Reference in New Issue
Block a user