summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexecute_format.sh1
-rw-r--r--packaging/vision-source-v4l2.spec2
-rw-r--r--src/vision_source_v4l2.cpp3
3 files changed, 4 insertions, 2 deletions
diff --git a/execute_format.sh b/execute_format.sh
new file mode 100755
index 0000000..bd0fd4b
--- /dev/null
+++ b/execute_format.sh
@@ -0,0 +1 @@
+find . -iname *.h -o -iname *.hpp -o -iname *.cpp -o -iname *.c | xargs clang-format-9 -i \ No newline at end of file
diff --git a/packaging/vision-source-v4l2.spec b/packaging/vision-source-v4l2.spec
index 2ecbb7a..702e777 100644
--- a/packaging/vision-source-v4l2.spec
+++ b/packaging/vision-source-v4l2.spec
@@ -3,7 +3,7 @@
Name: vision-source-v4l2
Summary: vision source-v4l2
-Version: 1.0.0
+Version: 1.0.1
Release: 0
Group: Multimedia/Framework
License: Apache-2.0
diff --git a/src/vision_source_v4l2.cpp b/src/vision_source_v4l2.cpp
index 606f4a0..9d7e075 100644
--- a/src/vision_source_v4l2.cpp
+++ b/src/vision_source_v4l2.cpp
@@ -410,6 +410,7 @@ static int __vision_source_list_devices(vision_source_v4l2_s *vs_handle)
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;
@@ -656,7 +657,7 @@ int vision_source_init(vision_source_h *handle)
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;
}