[PATCH] Handle memory allocation failure.

From: Jim Meyering
Date: Fri Feb 08 2008 - 12:52:46 EST


Hello,

I spotted a few unchecked memory allocation failures early this week
(here's the one that hasn't been taken yet)
http://article.gmane.org/gmane.linux.kernel/634811
and went looking for more. I found and fixed seven more:
[Thanks to Markus Armbruster for a rigorous review. ]

FYI, my first crack at cleaning up v9fs_parse_options
removed the match_strdup call altogether, but was more
invasive in that it added a new function, match_strcmp and
made the existing match_number function public.
The patch below just handles the match_strdup failure.

Also, with a new match_strlcpy function, one could avoid the
match_strdup call in fs/affs/super.c, and with a new
match_simple_strtoll function, one could avoid a few more
memory allocations. That's for another day...

Here's the patch:

-----------------------