diff --git a/frameworks/src/sensor_agent_proxy.c b/frameworks/src/sensor_agent_proxy.c index 00f47568e4f0810d2bad10e979c7b57c4670a28e..0b2e9880a7c4203dbfe4cc7937474138a964ac81 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 e04f215fe1c5b38b56fa57cc97658f2b6e69fd38..1e7518096d54711e8c3d3afe59dde2d6687efbcc 100755 --- 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);