for (size_t i = 0; i < dev_count; i++) {
vs_handle->dev_info[i].index = i;
strncpy(vs_handle->dev_info[i].name, dev_name[i].c_str(), DEVICE_NAME_LENGTH_MAX);
+ vs_handle->dev_info[i].name[DEVICE_NAME_LENGTH_MAX - 1] = '\0';
vs_handle->fmt[i] = (media_format_h *) calloc(dev_fmt_list[i].size(), sizeof(media_format_h));
if (!vs_handle->fmt[i]) {
return VISION_SOURCE_ERROR_OUT_OF_MEMORY;
int ret = __vision_source_list_devices(v4l2_handle);
if (ret != VISION_SOURCE_ERROR_NONE) {
- free(v4l2_handle);
+ delete v4l2_handle;
LOGE("get device info failed");
return ret;
}