Skip to content

Commit

Permalink
src/mount: check before dereference buf
Browse files Browse the repository at this point in the history
CID 180671 (#1 of 1): Dereference null return value (NULL_RETURNS)

Signed-off-by: songweibin <song.weibin@zte.com.cn>
  • Loading branch information
Songweibin committed Jul 26, 2019
1 parent e027012 commit b737cc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mount/mount.ceph.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b737cc4

Please sign in to comment.