about summary refs log tree commit diff
path: root/shared/systemd/src/basic/alloc-util.h
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2019-08-09 11:09:27 +0200
committerSebastien Bacher <seb128@ubuntu.com>2019-08-09 11:18:39 +0200
commit820498b2158e0b05421ce0922f203a0699927fa8 (patch)
tree3bf6d1089b762535ec5e59738d47ae2d2f54750f /shared/systemd/src/basic/alloc-util.h
parent1bd9f376796563dfb5016bada66c78b203f41d33 (diff)
parent488dda3930545969f5644b57cfca81e21df031c3 (diff)
Merge remote-tracking branch 'salsa/master'
Diffstat (limited to 'shared/systemd/src/basic/alloc-util.h')
-rw-r--r--shared/systemd/src/basic/alloc-util.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/shared/systemd/src/basic/alloc-util.h b/shared/systemd/src/basic/alloc-util.h
index 9b20be47..64d9e003 100644
--- a/shared/systemd/src/basic/alloc-util.h
+++ b/shared/systemd/src/basic/alloc-util.h
@@ -58,7 +58,7 @@ static inline void *mfree(void *memory) {
         })
 
 void* memdup(const void *p, size_t l) _alloc_(2);
-void* memdup_suffix0(const void *p, size_t l) _alloc_(2);
+void* memdup_suffix0(const void *p, size_t l); /* We can't use _alloc_() here, since we return a buffer one byte larger than the specified size */
 
 #define memdupa(p, l)                           \
         ({                                      \
@@ -112,7 +112,9 @@ _alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t size, si
         return memdup(p, size * need);
 }
 
-_alloc_(2, 3) static inline void *memdup_suffix0_multiply(const void *p, size_t size, size_t need) {
+/* Note that we can't decorate this function with _alloc_() since the returned memory area is one byte larger
+ * than the product of its parameters. */
+static inline void *memdup_suffix0_multiply(const void *p, size_t size, size_t need) {
         if (size_multiply_overflow(size, need))
                 return NULL;