summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-09-02 19:26:37 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-09-02 19:26:37 +0200
commit3ec73fc6825c6a0bd2a51364f8f8849245c89e25 (patch)
tree21c2022c3d07036ef829dce81fbbcddb20272ad6
parent2c797708b38729effe82328484d67a2be02412ed (diff)
gnunet-qr/uri: Fix exit code handling; fix memory corruption
-rw-r--r--src/util/gnunet-qr.c7
-rw-r--r--src/util/gnunet-uri.c2
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 @@
/**
* Video device to capture from. Sane default for GNU/Linux systems.
*/
-static char *device = "/dev/video0";
+static char *device;
/**
* --verbose option
@@ -51,7 +51,7 @@ static int silent = false;
/**
* Handler exit code
*/
-static long unsigned int exit_code = 1;
+static long unsigned int exit_code = 0;
/**
* Helper process we started.
@@ -228,6 +228,8 @@ get_symbol (zbar_processor_t *proc)
}
/* initialize the Processor */
+ if (NULL == device)
+ device = GNUNET_strdup ("/dev/video0");
if (0 != (rc = zbar_processor_init (proc, device, 1)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -306,6 +308,7 @@ run_zbar ()
ret = GNUNET_strdup (data);
/* clean up */
zbar_processor_destroy (proc);
+ GNUNET_free (device);
return ret;
}
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 @@
/**
* Handler exit code
*/
-static long unsigned int exit_code = 1;
+static long unsigned int exit_code = 0;
/**
* Helper process we started.