You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following code gives a false positive. Size of memptr is set inside the block and then released outside that block.
DEFINE VARIABLE mReceiveData AS MEMPTR NO-UNDO.
IF TRUE THEN DO:
SET-SIZE(mReceiveData) = 100.
END.
SET-SIZE(mReceiveData) = 0.
If release is done inside the same block or moved to finally-block, then issue is not raised.
Case 2:
Following code where copy-lob is done inside a nested block, gives false positive.
DEFINE VARIABLE mReceiveData AS MEMPTR NO-UNDO.
DEFINE VARIABLE mSendData AS MEMPTR NO-UNDO.
IF TRUE THEN DO: // First level
DO: // second level
COPY-LOB mReceiveData TO mSendData.
END.
END.
FINALLY:
SET-SIZE (mSendData) = 0.
END FINALLY.
For a comparison, this code, where there is only one block, issue is not raised:
DEFINE VARIABLE mReceiveData AS MEMPTR NO-UNDO.
DEFINE VARIABLE mSendData AS MEMPTR NO-UNDO.
IF TRUE THEN DO:
COPY-LOB mReceiveData TO mSendData.
END.
FINALLY:
SET-SIZE (mSendData) = 0.
END FINALLY.
This is similar to issue #1121 in DynamicObjectLeak rule
The text was updated successfully, but these errors were encountered:
Case 1:
Following code gives a false positive. Size of memptr is set inside the block and then released outside that block.
If release is done inside the same block or moved to finally-block, then issue is not raised.
Case 2:
Following code where copy-lob is done inside a nested block, gives false positive.
For a comparison, this code, where there is only one block, issue is not raised:
This is similar to issue #1121 in DynamicObjectLeak rule
The text was updated successfully, but these errors were encountered: