diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2012-05-21 00:07:57 +0200 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-05-21 00:12:33 +0200 |
commit | 7eb29aeec6f75f482d9ea3b2f94eb6899b830c60 (patch) | |
tree | d5d638a7a3299ba8e88a9138989cba47e8642b50 /src/mount/canonicalize.c | |
parent | crush: check malloc results (diff) | |
download | ceph-7eb29aeec6f75f482d9ea3b2f94eb6899b830c60.tar.xz ceph-7eb29aeec6f75f482d9ea3b2f94eb6899b830c60.zip |
check malloc return values
There were a few places where we didn't check malloc return code.
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'src/mount/canonicalize.c')
-rw-r--r-- | src/mount/canonicalize.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mount/canonicalize.c b/src/mount/canonicalize.c index b0df632b20c..c3bdb38d158 100644 --- a/src/mount/canonicalize.c +++ b/src/mount/canonicalize.c @@ -57,6 +57,8 @@ myrealpath(const char *path, char *resolved_path, int maxreslth) { /* Expand each slash-separated pathname component. */ link_path = malloc(PATH_MAX+1); + if (!link_path) + return NULL; while (*path != '\0') { /* Ignore stray "/" */ if (*path == '/') { @@ -179,6 +181,8 @@ canonicalize_path(const char *path) return NULL; canonical = malloc(PATH_MAX+2); + if (!canonical) + return NULL; if (!myrealpath(path, canonical, PATH_MAX+1)) { free(canonical); return strdup(path); |