| 123 | } |
| 124 | |
| 125 | void evs_free(fs_evs *sock) |
| 126 | { |
| 127 | struct list_head *_, *__; |
| 128 | struct fs_event *ev; |
| 129 | struct fs_esl_reply *reply; |
| 130 | |
| 131 | if (sock->ref > 0) { |
| 132 | LM_BUG("non-zero ref @ free"); |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | list_for_each_safe(_, __, &sock->events) { |
| 137 | ev = list_entry(_, struct fs_event, list); |
| 138 | shm_free(ev); |
| 139 | } |
| 140 | |
| 141 | list_for_each_safe(_, __, &sock->esl_replies) { |
| 142 | reply = list_entry(_, struct fs_esl_reply, list); |
| 143 | shm_free(reply->text.s); |
| 144 | shm_free(reply); |
| 145 | } |
| 146 | |
| 147 | shm_free(sock->host.s); |
| 148 | shm_free(sock->user.s); |
| 149 | shm_free(sock->pass.s); |
| 150 | pkg_free(sock->handle); |
| 151 | |
| 152 | lock_destroy_rw(sock->stats_lk); |
| 153 | lock_destroy_rw(sock->lists_lk); |
| 154 | |
| 155 | memset(sock, 0, sizeof *sock); |
| 156 | |
| 157 | sock->invalid = 1; /* safety check against dangling fds in reactor */ |
| 158 | shm_free(sock); |
| 159 | } |
| 160 | |
| 161 | static fs_evs *evs_init(const str *host, unsigned short port, |
| 162 | const str *user, const str *pass) |
no test coverage detected