]> git.draconx.ca Git - liblbx.git/commitdiff
lbximg: Fix improper free.
authorNick Bowler <nbowler@draconx.ca>
Wed, 10 Feb 2010 04:14:27 +0000 (23:14 -0500)
committerNick Bowler <nbowler@draconx.ca>
Wed, 10 Feb 2010 04:14:27 +0000 (23:14 -0500)
We were freeing the row buffer twice on the error path, and not at all
on the success path.

src/lbximg.c

index d76346b14b046c30566ad5dbb261dda13f7b4ed4..a2b74058069aa48ad984c45e276e5422f1fe4cb4 100644 (file)
@@ -163,7 +163,6 @@ int outpng(unsigned int frameno,
        }
 
        if (setjmp(png_jmpbuf(png))) {
-               free(row);
                png_destroy_write_struct(&png, &info);
                goto err;
        }
@@ -221,12 +220,11 @@ int outpng(unsigned int frameno,
 
        png_destroy_write_struct(&png, &info);
        fclose(of);
+       free(row);
 
        if (verbose)
                printf("wrote %s\n", name);
-
        return 0;
-
 err:
        fclose(of);
        remove(name);