mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
tools: avoid potential null pointer dereference by GCC 10
GCC 10 complains about "arg" possibly being a NULL dereference. Even though it might be a false positive, we can easily avoid it. Avoiding ../tools/vsh.c: In function ‘vshCommandOptStringReq’: ../tools/vsh.c:1034:19: error: potential null pointer dereference [-Werror=null-dereference] 1034 | else if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK)) | ~~~^~~~~~ Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
d96d359a03
commit
e2bd2af6e4
@ -1031,7 +1031,7 @@ vshCommandOptStringReq(vshControl *ctl,
|
||||
/* this should not be propagated here, just to be sure */
|
||||
if (ret == -1)
|
||||
error = N_("Mandatory option not present");
|
||||
else if (!*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK))
|
||||
else if (arg && !*arg->data && !(arg->def->flags & VSH_OFLAG_EMPTY_OK))
|
||||
error = N_("Option argument is empty");
|
||||
|
||||
if (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user