Fix two rule-reload memory leak issues by martinhsv · Pull Request #2801 · owasp-modsecurity/ModSecurity (original) (raw)

@martinhsv I suggest to avoid use:

if (transformations != NULL) { delete transformations; }

It's confused to free memory of constructor argument.

In the similiar #2728, I use shared_ptr to avoid delete.

For virtual ~Rule, it's ok. I have explained other solutions too: #2728 (comment)