Commit 70ba5251 authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

don't allocate pd.auddioDeviceStates from shm

git-svn-id: https://svn.musicpd.org/mpd/trunk@7306 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 4b2a1082
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment