From: Bartosz Golaszewski Date: Mon, 12 Jun 2017 09:01:52 +0000 (+0200) Subject: tests: fix a potential segfault X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=45a60afb1639c7f9545664d403ab97f770107bca;p=qemu-gpiodev%2Flibgpiod.git tests: fix a potential segfault A string passed to test_free_str() must be allocated by malloc() or NULL, so we need to initialize ptrn. Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/tests-gpioinfo.c b/tests/tests-gpioinfo.c index e2b7419..ff4a509 100644 --- a/tests/tests-gpioinfo.c +++ b/tests/tests-gpioinfo.c @@ -34,7 +34,7 @@ TEST_DEFINE(gpioinfo_simple, static void gpioinfo_one_exported(void) { TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL; - TEST_CLEANUP(test_free_str) char *ptrn; + TEST_CLEANUP(test_free_str) char *ptrn = NULL; struct gpiod_line *line; int rv;