ClusterLabs/booth — pull request #10 by inouekazu (2014-05-30 10:17:59+00:00)
Title: Fix: Add check to prevent segfault

The second argument of **copy_ticket_from_msg()** needs to be checked, since it may be NULL.

* [src/raft.c#L235]
```
235 become_follower(tk, NULL);
```
* [src/raft.c#L133]
```
130 static void become_follower(struct ticket_config *tk,
131 struct boothc_ticket_msg *msg)
132 {
133 copy_ticket_from_msg(tk, msg);
```
* [src/raft.c#L125]
```
122 static void copy_ticket_from_msg(struct ticket_config *tk,
123 struct boothc_ticket_msg *msg)
124 {
125 tk->term_expires = time(NULL) + ntohl(msg->ticket.term_valid_for);
```

I set the *time(NULL) + tk->term_duration* to *tk->term_expires* if *msg* is NULL, referring to the [update_ticket_from_msg()].

[src/raft.c#L235]: https://github.com/ClusterLabs/booth/blob/63c9085e88/src/raft.c#L235
[src/raft.c#L133]: https://github.com/ClusterLabs/booth/blob/63c9085e88/src/raft.c#L133
[src/raft.c#L125]: https://github.com/ClusterLabs/booth/blob/63c9085e88/src/raft.c#L125
[update_ticket_from_msg()]: https://github.com/ClusterLabs/booth/blob/63c9085e88/src/raft.c#L106