/src/libdraw/mouse.c /src/libdraw/writecolmap.c % cat >/sys/lib/dist/changes/1176503406.4.txt << EOF • Return nil if we have no memory to allocate. We already returned nil before, so we shouldn't need to check callers to ensure error checking. • We're writecolmap, not wrcolmap. Don't confuse people if they want to grep for writecolmap. EOF [geoff] --rw-rw-r-- M 121 glenda sys 2623 Apr 13 18:11 sys/src/libdraw/mouse.c /n/sourcesdump/2007/0413/plan9/sys/src/libdraw/mouse.c:108,113 - /n/sources/plan9/sys/src/libdraw/mouse.c:108,118 return nil; } t = malloc(strlen(file)+16); + if (t == nil) { + close(mc->mfd); + free(mc); + return nil; + } strcpy(t, file); sl = utfrrune(t, '/'); if(sl) [geoff] --rw-rw-r-- M 121 glenda sys 788 Apr 13 18:11 sys/src/libdraw/writecolmap.c /n/sourcesdump/2007/0413/plan9/sys/src/libdraw/writecolmap.c:18,25 - /n/sources/plan9/sys/src/libdraw/writecolmap.c:18,27 sprint(buf, "/dev/draw/%d/colormap", d->dirno); fd = open(buf, OWRITE); if(fd < 0) - drawerror(d, "wrcolmap: open colormap failed"); + drawerror(d, "writecolmap: open colormap failed"); t = malloc(8192); + if (t == nil) + drawerror(d, "writecolmap: no memory"); n = 0; for(i = 0; i < 256; i++) { r = m[i].red>>24; /n/sourcesdump/2007/0413/plan9/sys/src/libdraw/writecolmap.c:31,35 - /n/sources/plan9/sys/src/libdraw/writecolmap.c:33,37 free(t); close(fd); if(i != n) - drawerror(d, "wrcolmap: bad write"); + drawerror(d, "writecolmap: bad write"); }