Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d16eab71 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "audio-hal: handling resource leak for variable 'params'"

parents 0070cb22 e851bdd5
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -430,10 +430,13 @@ int on_dev_event(dev_event_t *dev_event)
    snprintf(val, sizeof(val), "%s,%s", dev_event->dev,
             dev_event->status ? "ON" : "OFF");

    if (str_parms_add_str(params, AUDIO_PARAMETER_KEY_EXT_AUDIO_DEVICE, val) < 0)
        return -1;
    int ret = 0;

    int ret = notify(params);
    if (str_parms_add_str(params, AUDIO_PARAMETER_KEY_EXT_AUDIO_DEVICE, val) < 0) {
        ret = -1;
    } else {
        ret = notify(params);
    }
    str_parms_destroy(params);
    return ret;
}
@@ -484,10 +487,13 @@ bool on_sndcard_state_update(sndcard_t *s)
    key = (is_cpe ?  "CPE_STATUS" :
          (is_slpi ? "SLPI_STATUS" :
                     "SND_CARD_STATUS"));
    if (str_parms_add_str(params, key, val) < 0)
        return -1;

    int ret = notify(params);
    int ret = 0;
    if (str_parms_add_str(params, key, val) < 0) {
        ret = -1;
    } else {
        ret = notify(params);
    }
    str_parms_destroy(params);
    return ret;
}