diff options
| author | Paul Eggert | 2021-07-12 00:06:34 -0700 |
|---|---|---|
| committer | Paul Eggert | 2021-07-12 00:12:21 -0700 |
| commit | 1a0fe2a5184cd4c57972994cf4b688042aecc534 (patch) | |
| tree | cb8b1b2c89cd5161d1c12f3aebcb1576f4482b37 /test/src | |
| parent | 2337869fbf8b967eb53ee57f978f3751987e43dc (diff) | |
| download | emacs-1a0fe2a5184cd4c57972994cf4b688042aecc534.tar.gz emacs-1a0fe2a5184cd4c57972994cf4b688042aecc534.zip | |
Pacify gcc 11.1.1 -Wanalyzer-possible-null-dereference
* oldXMenu/Create.c (XMenuCreate):
* oldXMenu/Internal.c (_XMRecomputePane, _XMRecomputeSelection):
* oldXMenu/XMakeAssoc.c (XMakeAssoc):
* test/src/emacs-module-resources/mod-test.c (Fmod_test_userptr_make):
Don’t assume that malloc and calloc succeed.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/emacs-module-resources/mod-test.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-module-resources/mod-test.c index ad59cfc18cd..5720af8c605 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c | |||
| @@ -288,6 +288,8 @@ struct super_struct | |||
| 288 | char large_unused_buffer[512]; | 288 | char large_unused_buffer[512]; |
| 289 | }; | 289 | }; |
| 290 | 290 | ||
| 291 | static void signal_errno (emacs_env *, char const *); | ||
| 292 | |||
| 291 | /* Return a new user-pointer to a super_struct, with amazing_int set | 293 | /* Return a new user-pointer to a super_struct, with amazing_int set |
| 292 | to the passed parameter. */ | 294 | to the passed parameter. */ |
| 293 | static emacs_value | 295 | static emacs_value |
| @@ -295,6 +297,8 @@ Fmod_test_userptr_make (emacs_env *env, ptrdiff_t nargs, emacs_value args[], | |||
| 295 | void *data) | 297 | void *data) |
| 296 | { | 298 | { |
| 297 | struct super_struct *p = calloc (1, sizeof *p); | 299 | struct super_struct *p = calloc (1, sizeof *p); |
| 300 | if (!p) | ||
| 301 | signal_errno (env, "calloc"); | ||
| 298 | p->amazing_int = env->extract_integer (env, args[0]); | 302 | p->amazing_int = env->extract_integer (env, args[0]); |
| 299 | return env->make_user_ptr (env, free, p); | 303 | return env->make_user_ptr (env, free, p); |
| 300 | } | 304 | } |