From: Haotian Li Date: Wed, 11 Nov 2020 01:10:38 +0000 (+0800) Subject: virtiofsd: check whether strdup lo.source return NULL in main func X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7632b56c8f880a8f86cf049a3785069e1ffd2997;p=qemu.git virtiofsd: check whether strdup lo.source return NULL in main func In main func, strdup lo.source may fail. So check whether strdup lo.source return NULL before using it. Signed-off-by: Haotian Li Signed-off-by: Zhiqiang Liu Message-Id: Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert --- diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c index 9545a0d174..97485b22b4 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -3517,6 +3517,10 @@ int main(int argc, char *argv[]) } } else { lo.source = strdup("/"); + if (!lo.source) { + fuse_log(FUSE_LOG_ERR, "failed to strdup source\n"); + goto err_out1; + } } if (lo.xattrmap) {