From: Florian Forster Date: Mon, 20 Nov 2017 10:13:02 +0000 (+0100) Subject: src/utils_ovs.c: Initialize pdb->sock to -1 earlier. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cae3cf94780b9992dfa6bae18417f0c5b03e4fab;p=collectd.git src/utils_ovs.c: Initialize pdb->sock to -1 earlier. ovs_db_destroy() was called before the field was initialized, leading to close(0) being called. --- diff --git a/src/utils_ovs.c b/src/utils_ovs.c index e3f5caad..3c448e3e 100644 --- a/src/utils_ovs.c +++ b/src/utils_ovs.c @@ -1006,6 +1006,7 @@ ovs_db_t *ovs_db_init(const char *node, const char *service, ovs_db_t *pdb = calloc(1, sizeof(*pdb)); if (pdb == NULL) return NULL; + pdb->sock = -1; /* store the OVS DB address */ sstrncpy(pdb->node, node, sizeof(pdb->node)); @@ -1047,7 +1048,6 @@ ovs_db_t *ovs_db_init(const char *node, const char *service, } /* init polling thread */ - pdb->sock = -1; if (ovs_db_poll_thread_init(pdb) < 0) { ovs_db_destroy(pdb); return NULL;