Mercurial > mplayer.hg
changeset 9583:e442209e6241
Fix small memleak in control().
author | ranma |
---|---|
date | Fri, 14 Mar 2003 17:19:19 +0000 |
parents | c9012dcd3a70 |
children | 31126ea5cd36 |
files | libao2/ao_nas.c |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_nas.c Fri Mar 14 15:06:21 2003 +0000 +++ b/libao2/ao_nas.c Fri Mar 14 17:19:19 2003 +0000 @@ -339,6 +339,8 @@ AuFixedPoint fpgain; AuStatus as; int gain; + int retval = CONTROL_UNKNOWN; + ao_control_vol_t *vol = (ao_control_vol_t *)arg; dattr = AuGetDeviceAttributes(nas_data->aud, nas_data->dev, &as); @@ -356,7 +358,9 @@ vol->right = (float) gain; vol->left = vol->right; - return CONTROL_OK; + mp_msg(MSGT_AO, MSGL_DBG2, "ao_nas: AOCONTROL_GET_VOLUME: %d\n", gain); + retval = CONTROL_OK; + break; case AOCONTROL_SET_VOLUME: /* @@ -365,6 +369,7 @@ * so i take the mean of both values. */ gain = (int) ((vol->left+vol->right)/2); + mp_msg(MSGT_AO, MSGL_DBG2, "ao_nas: AOCONTROL_SET_VOLUME: %d\n", gain); fpgain = AuFixedPointFromSum(gain, 0); AuDeviceGain(dattr) = fpgain; @@ -373,13 +378,13 @@ if (as != AuSuccess) { nas_print_error(nas_data->aud, "control(): AuSetDeviceAttributes", as); - return CONTROL_ERROR; - } - return CONTROL_OK; + retval = CONTROL_ERROR; + } else retval = CONTROL_OK; + break; + }; - default: - return CONTROL_UNKNOWN; - }; + AuFreeDeviceAttributes(nas_data->aud, 1, dattr); + return retval; } // open & setup audio device