font: free errors

This commit is contained in:
Michael Stapelberg 2016-01-09 17:07:23 +01:00
parent 17c55792c6
commit 9b4efdc194
1 changed files with 5 additions and 0 deletions

View File

@ -224,6 +224,7 @@ i3Font load_font(const char *pattern, const bool fallback) {
info_cookie = xcb_query_font(conn, font.specific.xcb.id);
/* Check if we managed to open 'fixed' */
free(error);
error = xcb_request_check(conn, font_cookie);
/* Fall back to '-misc-*' if opening 'fixed' fails. */
@ -234,12 +235,16 @@ i3Font load_font(const char *pattern, const bool fallback) {
strlen(pattern), pattern);
info_cookie = xcb_query_font(conn, font.specific.xcb.id);
free(error);
if ((error = xcb_request_check(conn, font_cookie)) != NULL)
errx(EXIT_FAILURE, "Could open neither requested font nor fallbacks "
"(fixed or -misc-*): X11 error %d",
error->error_code);
}
}
if (error != NULL) {
free(error);
}
font.pattern = sstrdup(pattern);
LOG("Using X font %s\n", pattern);