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

Commit 97343328 authored by David Ng's avatar David Ng Committed by Steve Kondik
Browse files

Fix potential NULL pointer deference in ToneGenerator destructor

Initial members in ToneGenerator so destructor can free
allocation properly.

Change-Id: I4a686084af48f99d2eefc33e56e3239846d3d34f
parent 5b3f5c54
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -798,7 +798,8 @@ const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1
//        none
//
////////////////////////////////////////////////////////////////////////////////
ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava) {
ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava)
    : mpAudioTrack(NULL), mpToneDesc(NULL), mpNewToneDesc(NULL) {

    ALOGV("ToneGenerator constructor: streamType=%d, volume=%f", streamType, volume);

@@ -811,9 +812,6 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool
    mThreadCanCallJava = threadCanCallJava;
    mStreamType = streamType;
    mVolume = volume;
    mpAudioTrack = NULL;
    mpToneDesc = NULL;
    mpNewToneDesc = NULL;
    // Generate tone by chunks of 20 ms to keep cadencing precision
    mProcessSize = (mSamplingRate * 20) / 1000;