Skip to content

Commit

Permalink
free icon memory if it doesn't contain usable icon
Browse files Browse the repository at this point in the history
The memory that is being allocated for each icon is limited for speed
(related: #85).
When the application has huge icons (1024x1024), this triggered a bug:
the allocated memory was not freed (#107).
  • Loading branch information
sagb committed Mar 14, 2021
1 parent d27ee2d commit cb7dd8f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ int addIconFromProperty(WindowInfo * wi)
}
if (best == 0) {
msg(0, "%s found but no suitable icons in it\n", NWI);
//free(prop); better don't
free(pro);
return 0;
}
msg(1, "using %dx%d %s icon for %lx\n", w, h, NWI, wi->id);
Expand Down Expand Up @@ -262,6 +262,7 @@ int addIconFromProperty(WindowInfo * wi)
wi->icon_allocated = true;
wi->icon_w = best_w;
wi->icon_h = best_h;
XFree(img);
free(image32);
free(pro);
return 1;
Expand Down

0 comments on commit cb7dd8f

Please sign in to comment.