@@ -203,7 +203,7 @@ create_rpc_response(hg_handle_t handle,
203203 if (NULL != new_rpc ) {
204204 LOGDBG ("created state for response rpc(%p) with handle(%p)" ,
205205 new_rpc , handle );
206-
206+
207207 new_rpc -> initiator = 0 ;
208208 new_rpc -> handle = handle ;
209209
@@ -216,11 +216,11 @@ create_rpc_response(hg_handle_t handle,
216216 assert (hgi );
217217 new_rpc -> rpc_id = hgi -> id ;
218218 }
219-
219+
220220 if (NULL != input ) {
221221 new_rpc -> inputs = input ;
222222 new_rpc -> have_input = 1 ;
223- }
223+ }
224224
225225 if (NULL != output ) {
226226 new_rpc -> outputs = output ;
@@ -268,7 +268,12 @@ int cleanup_rpc_state(rpc_state* rpc)
268268 if (HG_BULK_NULL != rpc -> bulk ) {
269269 LOGDBG ("calling margo_bulk_free(%p) for rpc(%p)" , rpc -> bulk , rpc );
270270 margo_bulk_free (rpc -> bulk );
271- }
271+ }
272+
273+ if (NULL != rpc -> bulk_buf ) {
274+ LOGDBG ("freeing bulk buffer(%p) for rpc(%p)" , rpc -> bulk_buf , rpc );
275+ free (rpc -> bulk_buf );
276+ }
272277
273278 if ((NULL != rpc -> inputs ) && (0 != rpc -> inputs_sz )) {
274279 /* free since we allocated it */
@@ -387,7 +392,7 @@ int async_rpc_request_finish(rpc_state* rpc)
387392 return EINVAL ;
388393
389394 int ret = UNIFYFS_SUCCESS ;
390-
395+
391396 hg_return_t hret = margo_wait (rpc -> mreq );
392397 if (hret == HG_SUCCESS ) {
393398 if (NULL != rpc -> outputs ) {
@@ -408,7 +413,7 @@ int async_rpc_request_finish(rpc_state* rpc)
408413 LOGERR ("margo_wait(%p) failed - %s" ,
409414 rpc -> mreq , HG_Error_to_string (hret ));
410415 ret = UNIFYFS_ERROR_MARGO ;
411- }
416+ }
412417 return ret ;
413418}
414419
@@ -563,7 +568,7 @@ int push_margo_bulk(hg_handle_t rpc_hdl,
563568 HG_Error_to_string (hret ));
564569 return UNIFYFS_ERROR_MARGO ;
565570 }
566-
571+
567572 /* execute the transfer to push data from local buffer
568573 * into remote buffer.
569574 *
@@ -590,7 +595,7 @@ int push_margo_bulk(hg_handle_t rpc_hdl,
590595
591596 if (hret == HG_SUCCESS ) {
592597 LOGDBG ("successful bulk push (%zu bytes)" , buf_sz );
593-
598+
594599 /* deregister our bulk transfer buffer */
595600 margo_bulk_free (bulk_local );
596601 } else {
0 commit comments