Skip to content

Commit

Permalink
[irods#6672] Fix struct clearing for getRescQuota API
Browse files Browse the repository at this point in the history
  • Loading branch information
alanking committed Oct 6, 2023
1 parent 1f2c129 commit 0fe0e33
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api/include/irods/apiTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ static irods::apidef_t client_api_table_inp[] = {
GET_RESC_QUOTA_AN, RODS_API_VERSION, REMOTE_USER_AUTH, REMOTE_USER_AUTH,
"getRescQuotaInp_PI", 0, "rescQuota_PI", 0,
boost::any(std::function<int(rsComm_t*,getRescQuotaInp_t*,rescQuota_t**)>(RS_GET_RESC_QUOTA)),
"api_get_resc_quota", irods::clearInStruct_noop, clearDataObjInfo,
"api_get_resc_quota", clearRescQuotaInp, clearRescQuota,
(funcPtr)CALL_GETRESCQUOTAINP_RESCQUOTAOUT
},
{
Expand Down
4 changes: 4 additions & 0 deletions lib/core/include/irods/rcMisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ void clearBytesBuffer(void* _p);

void clearSwitchUserInput(void* _p);

void clearRescQuota(void* _p);

void clearRescQuotaInp(void* _p);

// clang-format off
__attribute__((deprecated("SimpleQuery is deprecated. Use GenQuery or SpecificQuery instead.")))
void clearSimpleQueryOut(void* _p);
Expand Down
26 changes: 26 additions & 0 deletions lib/core/src/rcMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,32 @@ freeAllRescQuota( rescQuota_t *rescQuotaHead ) {
return 0;
}

void clearRescQuotaInp(void* _p)
{
if (!_p) {
return;
}

auto* q = static_cast<getRescQuotaInp*>(_p);

clearKeyVal(&q->condInput);

std::memset(q, 0, sizeof(getRescQuotaInp));
} // clearRescQuotaInp

void clearRescQuota(void* _p)
{
if (!_p) {
return;
}

auto* q = static_cast<rescQuota*>(_p);

freeAllRescQuota(q->next);

std::memset(q, 0, sizeof(rescQuota));
} // clearRescQuota

int
parseMultiStr( char *strInput, strArray_t *strArray ) {
char *startPtr, *endPtr;
Expand Down

0 comments on commit 0fe0e33

Please sign in to comment.