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

Commit 50d2ce03 authored by Greg Kaiser's avatar Greg Kaiser
Browse files

m4v_h263_enc_test: Fix leaks in error cases

These leaks aren't really consequential since this is a standalone
test.  But by putting in simple fixes for these, we reduce the
noise when using static analysis to find leaks in Android code.

Test: TreeHugger

Change-Id: Iace7028f8bc3951abf72ddcec2b741b7a5f61a3e
parent fb208d46
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -183,6 +183,10 @@ int main(int argc, char *argv[]) {
    // Initialize the encoder.
    if (!PVInitVideoEncoder(&handle, &encParams)) {
        fprintf(stderr, "Failed to initialize the encoder\n");
        fclose(fpInput);
        fclose(fpOutput);
        free(inputBuf);
        free(outputBuf);
        return EXIT_FAILURE;
    }

@@ -190,6 +194,10 @@ int main(int argc, char *argv[]) {
    int32_t headerLength = kOutputBufferSize;
    if (!PVGetVolHeader(&handle, outputBuf, &headerLength, 0)) {
        fprintf(stderr, "Failed to get VOL header\n");
        fclose(fpInput);
        fclose(fpOutput);
        free(inputBuf);
        free(outputBuf);
        return EXIT_FAILURE;
    }
    fwrite(outputBuf, 1, headerLength, fpOutput);