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

Commit 185bb2a9 authored by Ashish Kumar Gupta's avatar Ashish Kumar Gupta Committed by Android (Google) Code Review
Browse files

Merge "Fix memory leak in MtpFfsHandle." into main

parents ca37babb 80edb96a
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <memory>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -298,9 +297,12 @@ int MtpFfsHandle::start(bool ptp) {

void MtpFfsHandle::close() {
    // Join all child threads before destruction
    for (auto& thread : mChildThreads) {
        thread.join();
    int count = mChildThreads.size();
    for (int i = 0; i < count; i++) {
        mChildThreads[i].join();
        delete &mChildThreads[i];
    }
    mChildThreads.clear();

    io_destroy(mCtx);
    closeEndpoints();