Texture objects are COM objects so they have interfaces referring to them, each interface with one reference count. Each interface inherits from the IUnknown interface.
Each time you query an interface through IUnknown::QueryInterface (which increments the ref count), you should call IUnknown::Release on the queried interface to decrease the ref count.
The same is true for IUnknown::AddRef, which increments the refcount of a given interface instance.
The game factors a texture surface, so it has IDirectDrawSurface* (I can't remember which version) and later calls IDirectDrawSurface*::QueryInterface to get an IDirect3DTexture* interface.
Both interface instances are referring to the same object but ::Release is called only on one of them, so the object remain alive.
If you debug with MS ddraw and d3d then you can download symbol files for them in the debugger (ddraw.dll, d3dimm.dll, maybe d3d700.dll), so you can see where the IUnknown calls are made, and insert the missing Release somehow into the code.