@@ -749,6 +749,7 @@ void process_client_gfids_rpc(client_rpc_req_t* creq)
749749 // files, but only use the gfids. The client must then issue
750750 // a separate metaget request for each gfid.
751751 unifyfs_file_attr_t * file_attrs = NULL ;
752+ hg_bulk_t bulk_gfids = HG_BULK_NULL ;
752753 int * new_gfid_list = NULL ;
753754 int num_file_attrs = 0 ;
754755 ret = unifyfs_invoke_broadcast_metaget_all (& file_attrs ,
@@ -760,7 +761,7 @@ void process_client_gfids_rpc(client_rpc_req_t* creq)
760761 new_gfid_list = (int * ) calloc (num_file_attrs , sizeof (int ));
761762 if (NULL != new_gfid_list ) {
762763 /* initialize bulk handle for the gfid_list */
763- hg_bulk_t bulk_gfids ;
764+
764765 hg_size_t sizes [1 ] = { num_file_attrs * sizeof (int ) };
765766 void * ptrs [1 ] = { (void * )new_gfid_list };
766767 hret = margo_bulk_create (unifyfsd_rpc_context -> shm_mid ,
@@ -776,7 +777,7 @@ void process_client_gfids_rpc(client_rpc_req_t* creq)
776777 new_gfid_list [i ] = file_attrs [i ].gfid ;
777778 }
778779 out -> bulk_gfids = bulk_gfids ;
779- creq -> req_state -> bulk = bulk_gfids ;
780+ creq -> req_state -> bulk = bulk_gfids ; // free on rpc cleanup
780781 }
781782 } else {
782783 ret = ENOMEM ;
@@ -789,9 +790,9 @@ void process_client_gfids_rpc(client_rpc_req_t* creq)
789790 /* send rpc response and cleanup request state */
790791 sync_respond_client (creq , rpc_name );
791792
792-
793- if (NULL != new_gfid_list )
793+ if (NULL != new_gfid_list ) {
794794 free (new_gfid_list );
795+ }
795796
796797 if (NULL != file_attrs )
797798 free (file_attrs );
@@ -843,6 +844,7 @@ static void unifyfs_mount_rpc(hg_handle_t handle)
843844 if (hret != HG_SUCCESS ) {
844845 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
845846 }
847+ margo_destroy (handle );
846848 return ;
847849 }
848850 process_client_mount_rpc (creq );
@@ -865,6 +867,7 @@ static void unifyfs_attach_rpc(hg_handle_t handle)
865867 if (hret != HG_SUCCESS ) {
866868 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
867869 }
870+ margo_destroy (handle );
868871 return ;
869872 }
870873 process_client_attach_rpc (creq );
@@ -885,6 +888,7 @@ static void unifyfs_unmount_rpc(hg_handle_t handle)
885888 if (hret != HG_SUCCESS ) {
886889 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
887890 }
891+ margo_destroy (handle );
888892 return ;
889893 }
890894 process_client_unmount_rpc (creq );
@@ -907,6 +911,7 @@ static void unifyfs_metaget_rpc(hg_handle_t handle)
907911 if (hret != HG_SUCCESS ) {
908912 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
909913 }
914+ margo_destroy (handle );
910915 return ;
911916 }
912917 process_client_metaget_rpc (creq );
@@ -929,6 +934,7 @@ static void unifyfs_metaset_rpc(hg_handle_t handle)
929934 if (hret != HG_SUCCESS ) {
930935 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
931936 }
937+ margo_destroy (handle );
932938 return ;
933939 }
934940 process_client_metaset_rpc (creq );
@@ -952,6 +958,7 @@ static void unifyfs_fsync_rpc(hg_handle_t handle)
952958 if (hret != HG_SUCCESS ) {
953959 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
954960 }
961+ margo_destroy (handle );
955962 return ;
956963 }
957964 process_client_fsync_rpc (creq );
@@ -974,6 +981,7 @@ static void unifyfs_filesize_rpc(hg_handle_t handle)
974981 if (hret != HG_SUCCESS ) {
975982 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
976983 }
984+ margo_destroy (handle );
977985 return ;
978986 }
979987 process_client_filesize_rpc (creq );
@@ -996,6 +1004,7 @@ static void unifyfs_transfer_rpc(hg_handle_t handle)
9961004 if (hret != HG_SUCCESS ) {
9971005 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
9981006 }
1007+ margo_destroy (handle );
9991008 return ;
10001009 }
10011010 process_client_transfer_rpc (creq );
@@ -1018,6 +1027,7 @@ static void unifyfs_truncate_rpc(hg_handle_t handle)
10181027 if (hret != HG_SUCCESS ) {
10191028 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
10201029 }
1030+ margo_destroy (handle );
10211031 return ;
10221032 }
10231033 process_client_truncate_rpc (creq );
@@ -1040,6 +1050,7 @@ static void unifyfs_unlink_rpc(hg_handle_t handle)
10401050 if (hret != HG_SUCCESS ) {
10411051 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
10421052 }
1053+ margo_destroy (handle );
10431054 return ;
10441055 }
10451056 process_client_unlink_rpc (creq );
@@ -1062,6 +1073,7 @@ static void unifyfs_laminate_rpc(hg_handle_t handle)
10621073 if (hret != HG_SUCCESS ) {
10631074 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
10641075 }
1076+ margo_destroy (handle );
10651077 return ;
10661078 }
10671079 process_client_laminate_rpc (creq );
@@ -1086,6 +1098,7 @@ static void unifyfs_mread_rpc(hg_handle_t handle)
10861098 if (hret != HG_SUCCESS ) {
10871099 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
10881100 }
1101+ margo_destroy (handle );
10891102 return ;
10901103 }
10911104 process_client_mread_rpc (creq );
@@ -1109,6 +1122,7 @@ static void unifyfs_read_extent_rpc(hg_handle_t handle)
11091122 if (hret != HG_SUCCESS ) {
11101123 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
11111124 }
1125+ margo_destroy (handle );
11121126 return ;
11131127 }
11141128 process_client_read_extent_rpc (creq );
@@ -1130,6 +1144,7 @@ static void unifyfs_get_gfids_rpc(hg_handle_t handle)
11301144 if (hret != HG_SUCCESS ) {
11311145 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
11321146 }
1147+ margo_destroy (handle );
11331148 return ;
11341149 }
11351150 process_client_gfids_rpc (creq );
@@ -1154,6 +1169,7 @@ static void unifyfs_node_local_extents_get_rpc(hg_handle_t handle)
11541169 if (hret != HG_SUCCESS ) {
11551170 LOGERR ("margo_respond() failed - %s" , HG_Error_to_string (hret ));
11561171 }
1172+ margo_destroy (handle );
11571173 return ;
11581174 }
11591175 process_client_node_local_extents_rpc (creq );
0 commit comments