Must use delete[] x when x was allocated as an array.
No need to check for NULL; "delete NULL" is always OK. (http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.7)
Don't depend on the compiler having old-style for scoping rules.
Remove extra iCurValueIndex/iCurParamIndex.