This is an archive of the discontinued Mercurial Phabricator instance.

index: remove side-effect from failed nt_new()
ClosedPublic

Authored by martinvonz on Aug 7 2018, 2:26 AM.

Details

Summary

As pointed out by Yuya in the review of D4108, if realloc() fails, we
would end up with an invalid nodetree instance (with nt->nodes set to
NULL), which means that if it was later accessed again it would likely
segfault. It's probably unlikely that much else happens in the process
if it ran out memory, but we should of course do our best to handle
it. This patch makes it so we don't update the nodetree in this case.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Aug 7 2018, 2:26 AM
This revision was automatically updated to reflect the committed changes.