I allocate a color entry with the next code, then I use it to draw correctly:
char *color_name = "red";
XColor color, exact;
XAllocNamedColor(display, colormap, color_name, &color, &exact);
Then, when I don't need anymore the color entry, I try to free it:
XFreeColors(display, colormap, &color.pixel, 1, 0);
This call generates the next error:
Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 88 (X_FreeColors)
Serial number of failed request: 17
Current serial number in output stream: 19
Is there something I'm doing wrong? How can I free that color entry? That color entry should be freed?