Fix some coverity issues in rgb.c