diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-09-02 19:26:37 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-09-02 19:26:37 +0200 |
commit | 3ec73fc6825c6a0bd2a51364f8f8849245c89e25 (patch) | |
tree | 21c2022c3d07036ef829dce81fbbcddb20272ad6 /src/util | |
parent | 2c797708b38729effe82328484d67a2be02412ed (diff) | |
download | gnunet-3ec73fc6825c6a0bd2a51364f8f8849245c89e25.tar.gz gnunet-3ec73fc6825c6a0bd2a51364f8f8849245c89e25.zip |
gnunet-qr/uri: Fix exit code handling; fix memory corruption
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/gnunet-qr.c | 7 | ||||
-rw-r--r-- | src/util/gnunet-uri.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c index 83b2af2fc..451d61d40 100644 --- a/src/util/gnunet-qr.c +++ b/src/util/gnunet-qr.c | |||
@@ -36,7 +36,7 @@ | |||
36 | /** | 36 | /** |
37 | * Video device to capture from. Sane default for GNU/Linux systems. | 37 | * Video device to capture from. Sane default for GNU/Linux systems. |
38 | */ | 38 | */ |
39 | static char *device = "/dev/video0"; | 39 | static char *device; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * --verbose option | 42 | * --verbose option |
@@ -51,7 +51,7 @@ static int silent = false; | |||
51 | /** | 51 | /** |
52 | * Handler exit code | 52 | * Handler exit code |
53 | */ | 53 | */ |
54 | static long unsigned int exit_code = 1; | 54 | static long unsigned int exit_code = 0; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Helper process we started. | 57 | * Helper process we started. |
@@ -228,6 +228,8 @@ get_symbol (zbar_processor_t *proc) | |||
228 | } | 228 | } |
229 | 229 | ||
230 | /* initialize the Processor */ | 230 | /* initialize the Processor */ |
231 | if (NULL == device) | ||
232 | device = GNUNET_strdup ("/dev/video0"); | ||
231 | if (0 != (rc = zbar_processor_init (proc, device, 1))) | 233 | if (0 != (rc = zbar_processor_init (proc, device, 1))) |
232 | { | 234 | { |
233 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 235 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -306,6 +308,7 @@ run_zbar () | |||
306 | ret = GNUNET_strdup (data); | 308 | ret = GNUNET_strdup (data); |
307 | /* clean up */ | 309 | /* clean up */ |
308 | zbar_processor_destroy (proc); | 310 | zbar_processor_destroy (proc); |
311 | GNUNET_free (device); | ||
309 | return ret; | 312 | return ret; |
310 | } | 313 | } |
311 | 314 | ||
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index 9443c9120..de0ff1f92 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c | |||
@@ -29,7 +29,7 @@ | |||
29 | /** | 29 | /** |
30 | * Handler exit code | 30 | * Handler exit code |
31 | */ | 31 | */ |
32 | static long unsigned int exit_code = 1; | 32 | static long unsigned int exit_code = 0; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Helper process we started. | 35 | * Helper process we started. |