The private context wasn't free'd when codec init failed. Restructure the code so that it can't happen.