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

Commit 302ea571 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Use the new radio_metadata wrapper for safer memory management.

Bug: b/34054813
Test: VTS, manual - both done in internal branch
Change-Id: I3ffb246af9a092d19a4f698d89ed0c03daa04431
parent 1fba0b75
Loading
Loading
Loading
Loading
+4 −7
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
*/
*/


#define LOG_TAG "IRadio"
#define LOG_TAG "IRadio"
//#define LOG_NDEBUG 0
#include <utils/Log.h>
#include <utils/Log.h>
#include <utils/Errors.h>
#include <utils/Errors.h>
#include <binder/IMemory.h>
#include <binder/IMemory.h>
@@ -23,7 +24,7 @@
#include <radio/IRadioService.h>
#include <radio/IRadioService.h>
#include <radio/IRadioClient.h>
#include <radio/IRadioClient.h>
#include <system/radio.h>
#include <system/radio.h>
#include <system/radio_metadata.h>
#include <system/RadioMetadataWrapper.h>


namespace android {
namespace android {


@@ -303,12 +304,9 @@ status_t BnRadio::onTransact(
        case GET_PROGRAM_INFORMATION: {
        case GET_PROGRAM_INFORMATION: {
            CHECK_INTERFACE(IRadio, data, reply);
            CHECK_INTERFACE(IRadio, data, reply);
            struct radio_program_info info;
            struct radio_program_info info;
            RadioMetadataWrapper metadataWrapper(&info.metadata);


            status_t status = radio_metadata_allocate(&info.metadata, 0, 0);
            status_t status = getProgramInformation(&info);
            if (status != NO_ERROR) {
                return status;
            }
            status = getProgramInformation(&info);
            reply->writeInt32(status);
            reply->writeInt32(status);
            if (status == NO_ERROR) {
            if (status == NO_ERROR) {
                reply->write(&info, sizeof(struct radio_program_info));
                reply->write(&info, sizeof(struct radio_program_info));
@@ -321,7 +319,6 @@ status_t BnRadio::onTransact(
                    reply->writeInt32(0);
                    reply->writeInt32(0);
                }
                }
            }
            }
            radio_metadata_deallocate(info.metadata);
            return NO_ERROR;
            return NO_ERROR;
        }
        }
        case HAS_CONTROL: {
        case HAS_CONTROL: {