Nominally, plugins are supposed to call TSHandleMLocRelease() for all TSMLoc values returned by the API. But in practice it is only necessary to call it for TSMLoc values that refer to MIME header fields:
https://github.com/apache/trafficserver/blob/d75af6f2eb6c63aa216111bd7f477f1f4c775580/src/traffic_server/InkAPI.cc#L2046 This adds significant complexity to plugin code. In some cases, the API itself forces plugins to ignore the nominal need to call the release function for TSMLoc values that don't refer for MIME header fields. TSRemapFromUrlGet() and TSRemapToUrlGet() returns TSMLoc values, but not a TSMBuffer value, making it impossible release the TSMLoc values. I propose adding the API function: void TSMimeHdrFieldMLocRelease(TSMbuffer, TSMLoc);