udev/collect: use _cleanup_ in one more place
This doesn't make the code pretty, but it at least makes it a tiny bit shorter.
This commit is contained in:
parent
3176084ff2
commit
ae34a10bac
|
@ -135,7 +135,8 @@ static int prepare(char *dir, char *filename)
|
||||||
static int checkout(int fd)
|
static int checkout(int fd)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char *buf, *ptr, *word = NULL;
|
_cleanup_free_ char *buf = NULL;
|
||||||
|
char *ptr, *word = NULL;
|
||||||
struct _mate *him;
|
struct _mate *him;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
|
@ -155,7 +156,6 @@ static int checkout(int fd)
|
||||||
bufsize = bufsize << 1;
|
bufsize = bufsize << 1;
|
||||||
if (debug)
|
if (debug)
|
||||||
fprintf(stderr, "ID overflow, restarting with size %zu\n", bufsize);
|
fprintf(stderr, "ID overflow, restarting with size %zu\n", bufsize);
|
||||||
free(buf);
|
|
||||||
lseek(fd, 0, SEEK_SET);
|
lseek(fd, 0, SEEK_SET);
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
@ -168,13 +168,10 @@ static int checkout(int fd)
|
||||||
if (debug)
|
if (debug)
|
||||||
fprintf(stderr, "Found word %s\n", word);
|
fprintf(stderr, "Found word %s\n", word);
|
||||||
him = malloc(sizeof (struct _mate));
|
him = malloc(sizeof (struct _mate));
|
||||||
if (!him) {
|
if (!him)
|
||||||
free(buf);
|
|
||||||
return log_oom();
|
return log_oom();
|
||||||
}
|
|
||||||
him->name = strdup(word);
|
him->name = strdup(word);
|
||||||
if (!him->name) {
|
if (!him->name) {
|
||||||
free(buf);
|
|
||||||
free(him);
|
free(him);
|
||||||
return log_oom();
|
return log_oom();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +188,6 @@ static int checkout(int fd)
|
||||||
ptr -= len;
|
ptr -= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue