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

Commit 3ab37d88 authored by Greg Kaiser's avatar Greg Kaiser Committed by android-build-merger
Browse files

Merge "fastboot: Don't leak file in error case" am: 3a197b37

am: 0c8a67bb

Change-Id: I3939b2c4a64f2d9f6513850abf00e93a2b904648
parents 6d2e1c73 0c8a67bb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -579,6 +579,7 @@ static int unzip_to_file(ZipArchiveHandle zip, char* entry_name) {
    ZipEntry zip_entry;
    if (FindEntry(zip, zip_entry_name, &zip_entry) != 0) {
        fprintf(stderr, "archive does not contain '%s'\n", entry_name);
        fclose(fp);
        return -1;
    }

@@ -586,10 +587,12 @@ static int unzip_to_file(ZipArchiveHandle zip, char* entry_name) {
    int error = ExtractEntryToFile(zip, &zip_entry, fd);
    if (error != 0) {
        fprintf(stderr, "failed to extract '%s': %s\n", entry_name, ErrorCodeString(error));
        fclose(fp);
        return -1;
    }

    lseek(fd, 0, SEEK_SET);
    // TODO: We're leaking 'fp' here.
    return fd;
}