aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:17:12 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:17:12 +0000
commit70ba52514447dd9e0d4925beda95d06fdb16dc6c (patch)
tree06975cd687251e96badbfaf2fa161dacbccb5efc /src
parent4b2a10825d14bc8192c53c0669e586579f4d0087 (diff)
downloadmpd-70ba52514447dd9e0d4925beda95d06fdb16dc6c.tar.gz
mpd-70ba52514447dd9e0d4925beda95d06fdb16dc6c.tar.xz
mpd-70ba52514447dd9e0d4925beda95d06fdb16dc6c.zip
don't allocate pd.auddioDeviceStates from shm
git-svn-id: https://svn.musicpd.org/mpd/trunk@7306 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/playerData.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/playerData.c b/src/playerData.c
index c2de08512..863283757 100644
--- a/src/playerData.c
+++ b/src/playerData.c
@@ -19,6 +19,7 @@
#include "playerData.h"
#include "conf.h"
#include "log.h"
+#include "utils.h"
#include "os_compat.h"
unsigned int buffered_before_play;
@@ -77,9 +78,6 @@ void initPlayerData(void)
/* for playerData struct */
allocationSize = sizeof(PlayerData);
- /* for audioDeviceStates[] */
- allocationSize += device_array_size;
-
if ((shmid = shmget(IPC_PRIVATE, allocationSize, IPC_CREAT | 0600)) < 0)
FATAL("problems shmget'ing\n");
if (!(playerData_pd = shmat(shmid, NULL, 0)))
@@ -87,8 +85,7 @@ void initPlayerData(void)
if (shmctl(shmid, IPC_RMID, NULL) < 0)
FATAL("problems shmctl'ing\n");
- playerData_pd->audioDeviceStates = (mpd_uint8 *)playerData_pd +
- allocationSize - device_array_size;
+ playerData_pd->audioDeviceStates = xmalloc(device_array_size);
initOutputBuffer(&(playerData_pd->buffer));
@@ -130,5 +127,7 @@ void freePlayerData(void)
* decoder have exited. Otherwise, their signal handlers will want to
* access playerData_pd and we need to keep it available for them */
waitpid(-1, NULL, 0);
+
+ free(playerData_pd->audioDeviceStates);
shmdt(playerData_pd);
}