summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 452324c)
raw | patch | inline | side by side (parent: 452324c)
author | Francesco Romani <fromani@redhat.com> | |
Wed, 23 Nov 2016 17:50:18 +0000 (18:50 +0100) | ||
committer | Francesco Romani <fromani@redhat.com> | |
Wed, 30 Nov 2016 09:27:00 +0000 (10:27 +0100) |
As per pull request review. Moving the variable assignement after
the check avoid any potential issues in the future.
Signed-off-by: Francesco Romani <fromani@redhat.com>
the check avoid any potential issues in the future.
Signed-off-by: Francesco Romani <fromani@redhat.com>
src/virt.c | patch | blob | history |
diff --git a/src/virt.c b/src/virt.c
index 18112c91c37e90db7dd6ed788b42f2bc6be66152..9ca4f0d72e1f6f29e1e129c839fe763d9daa317b 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
static int lv_read(user_data_t *ud) {
time_t t;
- struct lv_read_instance *inst = ud->data;
- struct lv_read_state *state = &inst->read_state;
- if (!inst) {
+ struct lv_read_instance *inst = NULL;
+ struct lv_read_state *state = NULL;
+ if (ud->data == NULL) {
ERROR(PLUGIN_NAME " plugin: NULL userdata");
return -1;
}
+ inst = ud->data;
+ state = &inst->read_state;
+
if (inst->id == 0 && conn == NULL) {
/* `conn_string == NULL' is acceptable. */
conn = virConnectOpenReadOnly(conn_string);