diff options
Diffstat (limited to 'examples/amqps_connect_timeout.c')
-rw-r--r-- | examples/amqps_connect_timeout.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/amqps_connect_timeout.c b/examples/amqps_connect_timeout.c index 81e1e91..972c2f7 100644 --- a/examples/amqps_connect_timeout.c +++ b/examples/amqps_connect_timeout.c @@ -68,6 +68,7 @@ int main(int argc, char const *const *argv) int timeout; amqp_socket_t *socket; amqp_connection_state_t conn; + struct timeval tval; struct timeval *tv; if (argc < 3) { @@ -83,10 +84,7 @@ int main(int argc, char const *const *argv) timeout = atoi(argv[3]); if (timeout > 0) { - tv = malloc(sizeof(struct timeval)); - if (tv == NULL) { - die("failed to malloc struct timeval"); - } + tv = &tval; tv->tv_sec = timeout; tv->tv_usec = 0; |