Minor compile warning fix
src/handler.c: In function 'handler_system_delete_all':
src/handler.c:706:25: warning: 'key2' may be used uninitialized in this function [-Wmaybe-uninitialized]
hash_add(conn->id_handlers, key2, head);
This commit is contained in:
@@ -694,19 +694,18 @@ void handler_system_delete_all(xmpp_conn_t *conn)
|
||||
} else
|
||||
item = item->next;
|
||||
}
|
||||
if (head != head_old)
|
||||
key2 = key;
|
||||
/* Hash table implementation is not perfect, so we need to find next
|
||||
key before dropping current one. Otherwise, we will get access to
|
||||
freed memory. */
|
||||
key = hash_iter_next(iter);
|
||||
key2 = hash_iter_next(iter);
|
||||
if (head != head_old) {
|
||||
/* hash_add() replaces value if the key exists */
|
||||
if (head != NULL)
|
||||
hash_add(conn->id_handlers, key2, head);
|
||||
hash_add(conn->id_handlers, key, head);
|
||||
else
|
||||
hash_drop(conn->id_handlers, key2);
|
||||
hash_drop(conn->id_handlers, key);
|
||||
}
|
||||
key = key2;
|
||||
}
|
||||
if (iter)
|
||||
hash_iter_release(iter);
|
||||
|
||||
Reference in New Issue
Block a user