diff --git a/frameworks/src/sensor_agent_proxy.c b/frameworks/src/sensor_agent_proxy.c index 62c347c34adafaf9bbd73a647f370998a23c644d..e1f01013308781dce89ade0be18b5186d934c406 100644 --- a/frameworks/src/sensor_agent_proxy.c +++ b/frameworks/src/sensor_agent_proxy.c @@ -130,7 +130,7 @@ int32_t GetSensorInfos(IOwner owner, IpcIo *reply) if (notify == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "%s notify is null", __func__); return SENSOR_ERROR_INVALID_PARAM; - } else { + } else { ReadInt32(reply, &(notify->retCode)); if (notify->retCode < 0) { HILOG_ERROR(HILOG_MODULE_APP, "%s failed, retCode: %d", __func__, notify->retCode); @@ -153,8 +153,9 @@ int32_t GetSensorInfos(IOwner owner, IpcIo *reply) return SENSOR_ERROR_INVALID_PARAM; } for (int32_t i = 0; i < notify->count; i++) { - if (memcpy_s((*(notify->sensorInfo) + i), sizeof(SensorInfo), (sensorInfo + i), - sizeof(SensorInfo))) { + errno_t ret = memcpy_s((*(notify->sensorInfo) + i), sizeof(SensorInfo), (sensorInfo + i), + sizeof(SensorInfo)); + if (ret != EOK) { HILOG_ERROR(HILOG_MODULE_APP, "%s copy sensorInfo failed", __func__); free(*(notify->sensorInfo)); *(notify->sensorInfo) = NULL; diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c index 1bfd09dfdcf99c3fea321afd7b0bf2852e4ccf26..eae0551662959b2b71646eec64238effae1b8fd8 100644 --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -132,7 +132,7 @@ int32_t UnsubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); WriteInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; - } else { + } else { SensorUser sensorUser; int32_t ret = defaultApi->UnsubscribeSensor(sensorId, &sensorUser); WriteInt32(reply, ret);