summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 053c00b069..60aa869439 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -582,7 +582,7 @@ send_control_event_string,(uint16_t event, event_format_t which,
conn->state == CONTROL_CONN_STATE_OPEN) {
control_connection_t *control_conn = TO_CONTROL_CONN(conn);
- if (control_conn->event_mask & (1<<event)) {
+ if (control_conn->event_mask & (((event_mask_t)1)<<event)) {
int is_err = 0;
connection_write_to_buf(msg, strlen(msg), TO_CONN(control_conn));
if (event == EVENT_ERR_MSG)
@@ -950,7 +950,7 @@ handle_control_setevents(control_connection_t *conn, uint32_t len,
const char *body)
{
int event_code = -1;
- uint32_t event_mask = 0;
+ event_mask_t event_mask = 0;
smartlist_t *events = smartlist_new();
(void) len;
@@ -978,7 +978,7 @@ handle_control_setevents(control_connection_t *conn, uint32_t len,
return 0;
}
}
- event_mask |= (1 << event_code);
+ event_mask |= (((event_mask_t)1) << event_code);
}
SMARTLIST_FOREACH_END(ev);
SMARTLIST_FOREACH(events, char *, e, tor_free(e));
@@ -1201,6 +1201,10 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len,
tor_free(password);
connection_printf_to_buf(conn, "515 Authentication failed: %s\r\n", errstr);
connection_mark_for_close(TO_CONN(conn));
+ if (sl) { /* clean up */
+ SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp));
+ smartlist_free(sl);
+ }
return 0;
ok:
log_info(LD_CONTROL, "Authenticated control connection ("TOR_SOCKET_T_FORMAT
@@ -2880,7 +2884,7 @@ handle_control_resolve(control_connection_t *conn, uint32_t len,
int is_reverse = 0;
(void) len; /* body is nul-terminated; it's safe to ignore the length */
- if (!(conn->event_mask & ((uint32_t)1L<<EVENT_ADDRMAP))) {
+ if (!(conn->event_mask & (((event_mask_t)1)<<EVENT_ADDRMAP))) {
log_warn(LD_CONTROL, "Controller asked us to resolve an address, but "
"isn't listening for ADDRMAP events. It probably won't see "
"the answer.");