ENOMEM can happen several times, so while loop it
Merge pull request #7 from unhammer/while-ENOMEM

ENOMEM can happen several times, so while loop it