mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-31 01:47:15 +03:00
udev/collect: avoid initalizing memory twice
This commit is contained in:
parent
48deb058b6
commit
7d56679902
@ -139,12 +139,14 @@ static int checkout(int fd)
|
||||
|
||||
restart:
|
||||
len = bufsize >> 1;
|
||||
buf = calloc(1,bufsize + 1);
|
||||
buf = malloc(bufsize + 1);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
return log_oom();
|
||||
}
|
||||
memset(buf, ' ', bufsize);
|
||||
buf[bufsize] = '\0';
|
||||
|
||||
ptr = buf + len;
|
||||
while ((read(fd, buf + len, len)) > 0) {
|
||||
while (ptr && *ptr) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user