diff options
| author | Paolo Bonzini | 2013-05-31 14:00:27 +0200 |
|---|---|---|
| committer | Michael Tokarev | 2013-06-01 12:25:39 +0200 |
| commit | a4cc73d629d43c8a4d171d043ff229a959df3ca6 (patch) | |
| tree | e4217378c556489b6f2f6e9b747978d931e7527b | |
| parent | m25p80: Add Micron n25q032a (diff) | |
| download | qemu-a4cc73d629d43c8a4d171d043ff229a959df3ca6.tar.gz qemu-a4cc73d629d43c8a4d171d043ff229a959df3ca6.tar.xz qemu-a4cc73d629d43c8a4d171d043ff229a959df3ca6.zip | |
do not check pointers after dereferencing them
Two instances, both spotted by Coverity. In one, two blocks were
swapped. In the other, the check is not needed anymore.
Cc: qemu-stable@nongnu.org
Cc: qemu-trivial@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
| -rw-r--r-- | monitor.c | 2 | ||||
| -rw-r--r-- | savevm.c | 8 |
2 files changed, 5 insertions, 5 deletions
@@ -280,7 +280,7 @@ void monitor_flush(Monitor *mon) buf = qstring_get_str(mon->outbuf); len = qstring_get_length(mon->outbuf); - if (mon && len && !mon->mux_out) { + if (len && !mon->mux_out) { rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len); if (rc == len) { /* all flushed */ @@ -322,13 +322,13 @@ QEMUFile *qemu_popen_cmd(const char *command, const char *mode) FILE *stdio_file; QEMUFileStdio *s; - stdio_file = popen(command, mode); - if (stdio_file == NULL) { + if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) { + fprintf(stderr, "qemu_popen: Argument validity check failed\n"); return NULL; } - if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) { - fprintf(stderr, "qemu_popen: Argument validity check failed\n"); + stdio_file = popen(command, mode); + if (stdio_file == NULL) { return NULL; } |
