From 17cfd8cecd8801924cd6aab0ec3baab460aadda8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 1 Aug 2021 17:30:17 -0700 Subject: [PATCH] exclude: improve -fanalyzer malloc checking --- ChangeLog | 2 +- lib/exclude.h | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8844434386..bac4c5fcc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ maint: improve -fanalyzer malloc checking * lib/backup-internal.h, lib/backupfile.h: - * lib/canonicalize.h, lib/dfa.h, lib/dirname.h: + * lib/canonicalize.h, lib/dfa.h, lib/dirname.h, lib/exclude.h: Add malloc-related attributes and include stdlib.h as needed. * lib/dfa.c: Include verify.h. (assume_nonnull): New macro. diff --git a/lib/exclude.h b/lib/exclude.h index 9ecfbc9854..8d6581afae 100644 --- a/lib/exclude.h +++ b/lib/exclude.h @@ -48,8 +48,11 @@ struct exclude; bool fnmatch_pattern_has_wildcards (const char *, int) _GL_ATTRIBUTE_PURE; -struct exclude *new_exclude (void) _GL_ATTRIBUTE_MALLOC; -void free_exclude (struct exclude *); +void free_exclude (struct exclude *) + _GL_ATTRIBUTE_NONNULL ((1)); +struct exclude *new_exclude (void) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_RETURNS_NONNULL + _GL_ATTRIBUTE_DEALLOC (free_exclude, 1); void add_exclude (struct exclude *, char const *, int); int add_exclude_file (void (*) (struct exclude *, char const *, int), struct exclude *, char const *, int, char); -- 2.39.5