From 3ec73fc6825c6a0bd2a51364f8f8849245c89e25 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Wed, 2 Sep 2020 19:26:37 +0200 Subject: gnunet-qr/uri: Fix exit code handling; fix memory corruption --- src/util/gnunet-qr.c | 7 +++++-- src/util/gnunet-uri.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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. -- cgit v1.2.3