summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-08-23 21:49:37 +0200
committerLennart Poettering <lennart@poettering.net>2009-08-23 21:49:37 +0200
commita0f01ddc951694e1d13f44dc3a5d0d3fb2daa142 (patch)
treeefdc48ba506b17cdbaa5644f9b40a91051efc998 /src
parentab5ac06ac76c3afbbd99bce2840329dd74756a73 (diff)
port a few things over to use xmalloc and friends instead of low-level libc malloc/free directly
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/core-util.c2
-rw-r--r--src/pulsecore/cpu-arm.c21
2 files changed, 11 insertions, 12 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 0eb32cc4..1c8c6780 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2223,7 +2223,7 @@ int pa_close_all(int except_fd, ...) {
va_end(ap);
r = pa_close_allv(p);
- free(p);
+ pa_xfree(p);
return r;
}
diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c
index 5a994b71..453b7848 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -2,7 +2,7 @@
This file is part of PulseAudio.
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
it under the terms of the GNU Lesser General Public License as published
@@ -60,21 +60,20 @@ static char *get_cpuinfo(void) {
char *cpuinfo;
int n, fd;
- if (!(cpuinfo = malloc(MAX_BUFFER)))
- return NULL;
+ cpuinfo = pa_xmalloc(MAX_BUFFER);
if ((fd = open("/proc/cpuinfo", O_RDONLY)) < 0) {
- free (cpuinfo);
+ pa_xfree(cpuinfo);
return NULL;
}
- if ((n = read(fd, cpuinfo, MAX_BUFFER-1)) < 0) {
- free (cpuinfo);
- close (fd);
+ if ((n = pa_read(fd, cpuinfo, MAX_BUFFER-1)) < 0) {
+ pa_xfree(cpuinfo);
+ pa_close(fd);
return NULL;
}
cpuinfo[n] = 0;
- close (fd);
+ pa_close(fd);
return cpuinfo;
}
@@ -102,7 +101,7 @@ void pa_cpu_init_arm (void) {
if (arch >= 7)
flags |= PA_CPU_ARM_V7;
- free (line);
+ pa_xfree(line);
}
/* get the CPU features */
if ((line = get_cpuinfo_line (cpuinfo, "Features"))) {
@@ -118,10 +117,10 @@ void pa_cpu_init_arm (void) {
else if (!strcmp (current, "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",
(flags & PA_CPU_ARM_V6) ? "V6 " : "",