From f223ac6ef92b7cf69048c81ff58b5c983c7d25da Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 12 Oct 2021 17:10:46 -0700 Subject: [PATCH] Fix test bug when calloc returns null MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * test/src/emacs-module-resources/mod-test.c (Fmod_test_userptr_make): Don’t dump core if calloc returns null and signal_errno returns. --- test/src/emacs-module-resources/mod-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-module-resources/mod-test.c index 5720af8c605..4c0b168e34d 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c @@ -298,7 +298,10 @@ Fmod_test_userptr_make (emacs_env *env, ptrdiff_t nargs, emacs_value args[], { struct super_struct *p = calloc (1, sizeof *p); if (!p) - signal_errno (env, "calloc"); + { + signal_errno (env, "calloc"); + return NULL; + } p->amazing_int = env->extract_integer (env, args[0]); return env->make_user_ptr (env, free, p); } -- 2.39.2