Skip to content

Commit fb818b2

Browse files
committed
util: use alloca0() intead of alloca() + memzero()
1 parent c07aead commit fb818b2

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/python-systemd/_journal.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ static PyObject *journal_sendv(PyObject *self, PyObject *args) {
4141

4242
/* Allocate an array for the argument strings */
4343
argc = PyTuple_Size(args);
44-
encoded = alloca(argc * sizeof(PyObject*));
45-
memzero(encoded, argc * sizeof(PyObject*));
44+
encoded = alloca0(argc * sizeof(PyObject*));
4645

4746
/* Allocate sufficient iovector space for the arguments. */
4847
iov = alloca(argc * sizeof(struct iovec));

src/readahead/readahead-collect.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ static int pack_file(FILE *pack, const char *fn, bool on_btrfs) {
129129
}
130130

131131
pages = l / page_size();
132-
vec = alloca(pages);
133-
memzero(vec, pages);
132+
vec = alloca0(pages);
134133
if (mincore(start, l, vec) < 0) {
135134
log_warning("mincore(%s) failed: %m", fn);
136135
r = -errno;

0 commit comments

Comments
 (0)