fix bug-1060 bug-1067
This commit is contained in:
parent
6067ba6c94
commit
61e1391cd0
28 changed files with 7021 additions and 2926 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include "netio.h"
|
||||
#include "typemap.h"
|
||||
#include "utils.h"
|
||||
#include "controller.capnp.h" /* free_CtrlStatus_ptr, free_ClusterConf_ptr */
|
||||
#include "xcectx.h"
|
||||
|
||||
static int handle_get_reply(xce_ctx_t* ctx, xce_reply_t* reply)
|
||||
|
|
@ -71,6 +72,14 @@ static int handle_reply(xce_ctx_t* ctx, xce_reply_t* reply)
|
|||
case OPCode_clusterconf:
|
||||
rc = -1;
|
||||
if (reply->data_which == RequestReply_data_clusterconf) {
|
||||
/* Free a prior unconsumed reply before storing the new one.
|
||||
* The consumer xce_clusterconf() MOVE_PTRs out, so in the normal
|
||||
* single-request-per-ctx path this is a no-op; on a re-stolen slot
|
||||
* (reply decode on a stale fd after client rotation) it prevents
|
||||
* a permanent heap leak of the prior occupant. */
|
||||
if (ctx->reply.u.clusterconf) {
|
||||
free_ClusterConf_ptr(&ctx->reply.u.clusterconf);
|
||||
}
|
||||
MOVE_PTR(ctx->reply.u.clusterconf, reply->data.clusterconf);
|
||||
rc = 1;
|
||||
}
|
||||
|
|
@ -78,6 +87,9 @@ static int handle_reply(xce_ctx_t* ctx, xce_reply_t* reply)
|
|||
case OPCode_ctrlstatus:
|
||||
rc = -1;
|
||||
if (reply->data_which == RequestReply_data_ctrlstatus) {
|
||||
if (ctx->reply.u.ctrlstatus) {
|
||||
free_CtrlStatus_ptr(&ctx->reply.u.ctrlstatus);
|
||||
}
|
||||
MOVE_PTR(ctx->reply.u.ctrlstatus, reply->data.ctrlstatus);
|
||||
rc = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue