From: Theo Buehler Date: Wed, 23 Aug 2017 13:48:58 +0000 (+0200) Subject: Avoid use of uninitialized in init_dpi_end X-Git-Tag: 4.14.1~71 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e8dbf0171de8c7399dcdfc3c42610e5f3bf418d1;p=i3%2Fi3 Avoid use of uninitialized in init_dpi_end If conn == NULL or display == NULL, init_dpi() jumps to init_dpi_end before (declaring and) initializing resource. In init_dpi_end, there is a free(resource) call conditionally on resource != NULL, so this may lead to a bogus free. Found by clang -Wsometimes-uninitialized. --- diff --git a/libi3/dpi.c b/libi3/dpi.c index ce85cacc..93a3c6f6 100644 --- a/libi3/dpi.c +++ b/libi3/dpi.c @@ -24,6 +24,7 @@ static long init_dpi_fallback(void) { */ void init_dpi(void) { xcb_xrm_database_t *database = NULL; + char *resource = NULL; if (conn == NULL) { goto init_dpi_end; @@ -35,7 +36,6 @@ void init_dpi(void) { goto init_dpi_end; } - char *resource; xcb_xrm_resource_get_string(database, "Xft.dpi", NULL, &resource); if (resource == NULL) { DLOG("Resource Xft.dpi not specified, skipping.\n");