From: songweibin Date: Thu, 25 Jul 2019 11:05:33 +0000 (+0800) Subject: src/mount: check before dereference buf X-Git-Tag: v15.1.0~2056^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b737cc424850a5108898a065f9572804b2b0ce49;p=ceph-ci.git src/mount: check before dereference buf CID 180671 (#1 of 1): Dereference null return value (NULL_RETURNS) Signed-off-by: songweibin --- diff --git a/src/mount/mount.ceph.c b/src/mount/mount.ceph.c index 1345e7f4512..24d320833f2 100644 --- a/src/mount/mount.ceph.c +++ b/src/mount/mount.ceph.c @@ -40,6 +40,10 @@ static char *mount_resolve_src(const char *orig_str) char *mount_path; char *src; char *buf = strdup(orig_str); + if (!buf) { + fprintf(stderr, "%s: failed to allocate memory\n", __func__); + return NULL; + } mount_path = strstr(buf, ":/"); if (!mount_path) {