mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-29 00:32:34 +08:00
Fix pointer indirection precedence issue in docs
Without this change, a segmentation fault is likely to occur when using the proposed snippet of code, as `*address[size]` is equivalent to `*(address[size])`, not `(*address)[size]` as clearly intended.
This commit is contained in:
parent
2c94bb42c5
commit
1fbc67a40a
@ -150,7 +150,7 @@ get_monitor_event (void *monitor, int *value, char **address)
|
|||||||
size_t size = zmq_msg_size (&msg);
|
size_t size = zmq_msg_size (&msg);
|
||||||
*address = (char *) malloc (size + 1);
|
*address = (char *) malloc (size + 1);
|
||||||
memcpy (*address, data, size);
|
memcpy (*address, data, size);
|
||||||
*address [size] = 0;
|
(*address)[size] = 0;
|
||||||
}
|
}
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user