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

Commit 1d50879b authored by Narayan Kamath's avatar Narayan Kamath Committed by Gerrit Code Review
Browse files

Merge "Remove memory leak in PersistentDataBlockService jni"

parents 3b43f862 c90ca48a
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <android_runtime/AndroidRuntime.h>
#include <JNIHelp.h>
#include <jni.h>
#include <ScopedUtfChars.h>

#include <utils/misc.h>
#include <sys/ioctl.h>
@@ -77,8 +78,8 @@ namespace android {

    static jlong com_android_server_PersistentDataBlockService_getBlockDeviceSize(JNIEnv *env, jclass, jstring jpath)
    {
        const char *path = env->GetStringUTFChars(jpath, 0);
        int fd = open(path, O_RDONLY);
        ScopedUtfChars path(env, jpath);
        int fd = open(path.c_str(), O_RDONLY);

        if (fd < 0)
            return 0;
@@ -87,8 +88,8 @@ namespace android {
    }

    static int com_android_server_PersistentDataBlockService_wipe(JNIEnv *env, jclass, jstring jpath) {
        const char *path = env->GetStringUTFChars(jpath, 0);
        int fd = open(path, O_WRONLY);
        ScopedUtfChars path(env, jpath);
        int fd = open(path.c_str(), O_WRONLY);

        if (fd < 0)
            return 0;