Fixed PHP-1278: runcommand memory leak

Extracted from https://github.com/mongodb/mongo-php-driver/pull/764