WebObjects 4.5: Memory Leak in LDAPAdaptor Example Code

This article explains how to fix a memory leak in the WebObjects 4.5 and 4.5.1 LDAPAdaptor example source code.

Symptom

There is a memory leak in the LDAPAdaptor example source code located in $NEXT_ROOT/Developer/Examples/EnterpriseObjects/Sources/LDAPAdaptor


Solution

A memory leak exists in LDAPChannel.m line 417. The following method declares an NSMutableArray, but never autoreleases it:


The original line looks like this:
To correct the leak, change line 417 to read:
After making this source code change, be sure to recompile the adaptor to incorporate the modifications.

Published Date: Feb 18, 2012