提交 8e00128d 编写于 作者: B Blue Swirl

Remove useless NULL checks for qemu_malloc return value

Found with this Coccinelle semantic patch:
@@
expression E;
identifier ptr;
identifier fn ~= "qemu_mallocz*";
@@

-ptr = fn(E);
-if (ptr == NULL) { ... }
-
+ptr = fn(E);
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 760e77ea
......@@ -2316,12 +2316,6 @@ int main(int argc, char **argv, char **envp)
len += strlen(qemu_opt_get(opts, "security_model"));
arg_fsdev = qemu_malloc((len + 1) * sizeof(*arg_fsdev));
if (!arg_fsdev) {
fprintf(stderr, "No memory to parse -fsdev for %s\n",
optarg);
exit(1);
}
sprintf(arg_fsdev, "%s,id=%s,path=%s,security_model=%s",
qemu_opt_get(opts, "fstype"),
qemu_opt_get(opts, "mount_tag"),
......@@ -2332,12 +2326,6 @@ int main(int argc, char **argv, char **envp)
len += 2*strlen(qemu_opt_get(opts, "mount_tag"));
arg_9p = qemu_malloc((len + 1) * sizeof(*arg_9p));
if (!arg_9p) {
fprintf(stderr, "No memory to parse -device for %s\n",
optarg);
exit(1);
}
sprintf(arg_9p, "virtio-9p-pci,fsdev=%s,mount_tag=%s",
qemu_opt_get(opts, "mount_tag"),
qemu_opt_get(opts, "mount_tag"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册