2009/6/15 Shawn O. Pearce <spearce@xxxxxxxxxxx>: > Alex Riesen <raa.lkml@xxxxxxxxx> wrote: >> As much as I'd like to know as much as possible about why something >> failed, I can't make a failure handling automatically simple (given the tools). >> I do suggest using goto to handle this particular OOM (below), but it looks >> almost too ugly. Maybe I am just paranoid, and am overdoing this particular >> case. > > Yes, this is horrible. Its a huge amount of code for checking a > strdup failure that is unlikely to occur out of a configuration file. > > Really, how big is that config file? It can't be so large that a > strdup() is likely to run out of memory pulling a value from it. Oh, I don't worry about config files being too big (it is noticeable without this checks). I'm worried about our bugs triggering the conditions where allocation routines return NULL, like heap corruption which is hard to notice without valgrind. >> The "goto oom" patch: > > NAK. We don't do this anywhere else in git. Please don't start now. We'll have to start paying more attention to memory management sometime. Although, this particular case may be not the best case for it. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html