diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-22 01:05:42 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-22 20:40:37 +0100 |
commit | 7d566799022b24fef2bb8ca6d671bf8ad14d9e26 (patch) | |
tree | 7f551ff78a65e9136cc025d6ef5c0363c87ebe0f /src/udev/collect | |
parent | util: workaround two gcc warnings (diff) | |
download | systemd-7d566799022b24fef2bb8ca6d671bf8ad14d9e26.tar.xz systemd-7d566799022b24fef2bb8ca6d671bf8ad14d9e26.zip |
udev/collect: avoid initalizing memory twice
Diffstat (limited to 'src/udev/collect')
-rw-r--r-- | src/udev/collect/collect.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c index 7850cfa418..6580a091e0 100644 --- a/src/udev/collect/collect.c +++ b/src/udev/collect/collect.c @@ -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) { |