[sr-dev] git:master:de48be80: core: fix a resource leak in the case for memory allocation error