diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-11-25 15:58:14 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-12-07 11:16:14 +0100 |
commit | b532ca3d2f1f1caab71c0aab979949882b695198 (patch) | |
tree | 10de5858b4e7f771beb8e9b39a4b8b7a7a52e1b2 /libavdevice/v4l2.c | |
parent | e1151fbf224da62f75fa975a1b18b7e74a13b1b1 (diff) | |
download | ffmpeg-b532ca3d2f1f1caab71c0aab979949882b695198.tar.gz |
lavd/v4l2: reduce variable scope
device and cap are local to the loop iteration, there is no need for
them to retain their values. Especially for device it may be dangerous,
since it points to av_malloc'ed data.
Diffstat (limited to 'libavdevice/v4l2.c')
-rw-r--r-- | libavdevice/v4l2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 4b7984f1b0..fefea54142 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -1019,8 +1019,6 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l struct video_data *s = ctx->priv_data; DIR *dir; struct dirent *entry; - AVDeviceInfo *device = NULL; - struct v4l2_capability cap; int ret = 0; if (!device_list) @@ -1033,6 +1031,8 @@ static int v4l2_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_l return ret; } while ((entry = readdir(dir))) { + AVDeviceInfo *device = NULL; + struct v4l2_capability cap; int fd = -1; char device_name[256]; |