mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
port a few things over to use xmalloc and friends instead of low-level libc malloc/free directly
This commit is contained in:
parent
ab5ac06ac7
commit
a0f01ddc95
2 changed files with 11 additions and 12 deletions
|
|
@ -2223,7 +2223,7 @@ int pa_close_all(int except_fd, ...) {
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
r = pa_close_allv(p);
|
r = pa_close_allv(p);
|
||||||
free(p);
|
pa_xfree(p);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
This file is part of PulseAudio.
|
This file is part of PulseAudio.
|
||||||
|
|
||||||
Copyright 2004-2006 Lennart Poettering
|
Copyright 2004-2006 Lennart Poettering
|
||||||
Copyright 2009 Wim Taymans <wim.taymans@collabora.co.uk>
|
Copyright 2009 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
PulseAudio is free software; you can redistribute it and/or modify
|
PulseAudio is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Lesser General Public License as published
|
it under the terms of the GNU Lesser General Public License as published
|
||||||
|
|
@ -60,21 +60,20 @@ static char *get_cpuinfo(void) {
|
||||||
char *cpuinfo;
|
char *cpuinfo;
|
||||||
int n, fd;
|
int n, fd;
|
||||||
|
|
||||||
if (!(cpuinfo = malloc(MAX_BUFFER)))
|
cpuinfo = pa_xmalloc(MAX_BUFFER);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if ((fd = open("/proc/cpuinfo", O_RDONLY)) < 0) {
|
if ((fd = open("/proc/cpuinfo", O_RDONLY)) < 0) {
|
||||||
free (cpuinfo);
|
pa_xfree(cpuinfo);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = read(fd, cpuinfo, MAX_BUFFER-1)) < 0) {
|
if ((n = pa_read(fd, cpuinfo, MAX_BUFFER-1)) < 0) {
|
||||||
free (cpuinfo);
|
pa_xfree(cpuinfo);
|
||||||
close (fd);
|
pa_close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cpuinfo[n] = 0;
|
cpuinfo[n] = 0;
|
||||||
close (fd);
|
pa_close(fd);
|
||||||
|
|
||||||
return cpuinfo;
|
return cpuinfo;
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +101,7 @@ void pa_cpu_init_arm (void) {
|
||||||
if (arch >= 7)
|
if (arch >= 7)
|
||||||
flags |= PA_CPU_ARM_V7;
|
flags |= PA_CPU_ARM_V7;
|
||||||
|
|
||||||
free (line);
|
pa_xfree(line);
|
||||||
}
|
}
|
||||||
/* get the CPU features */
|
/* get the CPU features */
|
||||||
if ((line = get_cpuinfo_line (cpuinfo, "Features"))) {
|
if ((line = get_cpuinfo_line (cpuinfo, "Features"))) {
|
||||||
|
|
@ -118,10 +117,10 @@ void pa_cpu_init_arm (void) {
|
||||||
else if (!strcmp (current, "vfpv3"))
|
else if (!strcmp (current, "vfpv3"))
|
||||||
flags |= PA_CPU_ARM_VFPV3;
|
flags |= PA_CPU_ARM_VFPV3;
|
||||||
|
|
||||||
free (current);
|
pa_xfree(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free (cpuinfo);
|
pa_xfree(cpuinfo);
|
||||||
|
|
||||||
pa_log_info ("CPU flags: %s%s%s%s%s%s",
|
pa_log_info ("CPU flags: %s%s%s%s%s%s",
|
||||||
(flags & PA_CPU_ARM_V6) ? "V6 " : "",
|
(flags & PA_CPU_ARM_V6) ? "V6 " : "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue