summaryrefslogtreecommitdiff
path: root/v4l2-apps
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-31 12:03:53 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2008-08-31 12:03:53 +0200
commit34584ca5eb9a254a02637b9141526f931cde3ce6 (patch)
treed7b3eb8907b64e5bc7d576d0b7008be3b05e6018 /v4l2-apps
parentde4091f9f2457f22920fe11cf7becb190334baa0 (diff)
downloadmediapointer-dvb-s2-34584ca5eb9a254a02637b9141526f931cde3ce6.tar.gz
mediapointer-dvb-s2-34584ca5eb9a254a02637b9141526f931cde3ce6.tar.bz2
v4l2-compliance: fix memory bug in handling of the -d option.
From: Hans Verkuil <hverkuil@xs4all.nl> Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'v4l2-apps')
-rw-r--r--v4l2-apps/util/v4l2-compliance.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/v4l2-apps/util/v4l2-compliance.cpp b/v4l2-apps/util/v4l2-compliance.cpp
index 0fb333a2d..2fe5292fe 100644
--- a/v4l2-apps/util/v4l2-compliance.cpp
+++ b/v4l2-apps/util/v4l2-compliance.cpp
@@ -998,7 +998,7 @@ int main(int argc, char **argv)
/* command args */
int ch;
- char *device = strdup("/dev/video0"); /* -d device */
+ const char *device = "/dev/video0"; /* -d device */
struct v4l2_capability vcap; /* list_cap */
char short_options[26 * 2 * 2 + 1];
int idx = 0;
@@ -1034,11 +1034,13 @@ int main(int argc, char **argv)
tests++;
break;
case OptSetDevice:
- device = strdup(optarg);
+ device = optarg;
if (device[0] >= '0' && device[0] <= '9' && device[1] == 0) {
+ static char newdev[20];
char dev = device[0];
- sprintf(device, "/dev/video%c", dev);
+ sprintf(newdev, "/dev/video%c", dev);
+ device = newdev;
}
break;
case ':':