Remove a local variable that was hiding the ec parameter and preventing error codes from being correctly propagated. Ref #3216.