sim-card
/
qemu
Archived
10
0
Fork 0

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: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Blue Swirl 2010-08-19 20:24:39 +00:00
parent 760e77eab5
commit 8e00128d32
1 changed files with 0 additions and 12 deletions

12
vl.c
View File

@ -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"));