Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Unlikely) memory leak in xcb_query_text_width #3621

Open
psychon opened this Issue Feb 15, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@psychon
Copy link
Contributor

psychon commented Feb 15, 2019

i3/libi3/font.c

Lines 427 to 444 in 2d6e09a

/* Query the text width */
xcb_generic_error_t *error;
xcb_query_text_extents_cookie_t cookie = xcb_query_text_extents(conn,
savedFont->specific.xcb.id, text_len, (xcb_char2b_t *)text);
xcb_query_text_extents_reply_t *reply = xcb_query_text_extents_reply(conn,
cookie, &error);
if (reply == NULL) {
/* We return a safe estimate because a rendering error is better than
* a crash. Plus, the user will see the error in their log. */
fprintf(stderr, "Could not get text extents (X error code %d)\n",
error->error_code);
return savedFont->specific.xcb.info->max_bounds.character_width * text_len;
}
int width = reply->overall_width;
free(reply);
return width;
}

What happened to free(error) inside reply == NULL?

@i3bot

This comment has been minimized.

Copy link

i3bot commented Feb 15, 2019

I don’t see a link to logs.i3wm.org. Did you follow https://i3wm.org/docs/debugging.html? (In case you actually provided a link to a logfile, please ignore me.)

@i3bot

This comment has been minimized.

Copy link

i3bot commented Feb 15, 2019

I don’t see a version number. Could you please copy & paste the output of i3 --version into this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.