diff options
Diffstat (limited to 'libudev')
-rw-r--r-- | libudev/libudev-util-private.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 5b5ecb1f50..b33ee79d6b 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -154,9 +154,12 @@ gid_t util_lookup_group(struct udev *udev, const char *group) buf = NULL; gid = 0; for (;;) { - buf = realloc(buf, buflen); - if (!buf) + char *newbuf; + + newbuf = realloc(buf, buflen); + if (!newbuf) break; + buf = newbuf; errno = getgrnam_r(group, &grbuf, buf, buflen, &gr); if (gr != NULL) { gid = gr->gr_gid; |