Commit b57fa326 authored by Arnaud Ferraris's avatar Arnaud Ferraris
Browse files

src: use GLib functions for memory allocation

parent 80e355e7
......@@ -60,7 +60,7 @@ static gboolean cad_manager_handle_select_mode(CallAudioDbusCallAudio *object,
return FALSE;
}
op = malloc(sizeof(CadOperation));
op = g_new(CadOperation, 1);
if (!op) {
g_critical("Unable to allocate memory for select mode operation");
g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,
......@@ -85,7 +85,7 @@ static gboolean cad_manager_handle_enable_speaker(CallAudioDbusCallAudio *object
{
CadOperation *op;
op = malloc(sizeof(CadOperation));
op = g_new(CadOperation, 1);
if (!op) {
g_critical("Unable to allocate memory for speaker operation");
g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,
......@@ -110,7 +110,7 @@ static gboolean cad_manager_handle_mute_mic(CallAudioDbusCallAudio *object,
{
CadOperation *op;
op = malloc(sizeof(CadOperation));
op = g_new(CadOperation, 1);
if (!op) {
g_critical("Unable to allocate memory for mic operation");
g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,
......
......@@ -482,7 +482,7 @@ static void set_mic_mute(pa_context *ctx, const pa_source_info *info, int eol, v
void cad_pulse_select_mode(guint mode, CadOperation *cad_op)
{
CadPulseOperation *operation = malloc(sizeof(CadPulseOperation));
CadPulseOperation *operation = g_new(CadPulseOperation, 1);
pa_operation *op = NULL;
if (!cad_op) {
......@@ -526,7 +526,7 @@ error:
void cad_pulse_enable_speaker(gboolean enable, CadOperation *cad_op)
{
CadPulseOperation *operation = malloc(sizeof(CadPulseOperation));
CadPulseOperation *operation = g_new(CadPulseOperation, 1);
pa_operation *op = NULL;
if (!cad_op) {
......@@ -566,7 +566,7 @@ error:
void cad_pulse_mute_mic(gboolean mute, CadOperation *cad_op)
{
CadPulseOperation *operation = malloc(sizeof(CadPulseOperation));
CadPulseOperation *operation = g_new(CadPulseOperation, 1);
pa_operation *op = NULL;
if (!cad_op) {
......
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