From c432811436b017cdabd207bb652291a42156c6d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= <heuripedes@gmail.com>
Date: Sat, 25 Apr 2015 21:04:52 -0300
Subject: [PATCH] (RPNG) Free zlib stream

---
 libretro-common/formats/png/rpng_fbio.c | 3 +++
 libretro-common/formats/png/rpng_nbio.c | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/libretro-common/formats/png/rpng_fbio.c b/libretro-common/formats/png/rpng_fbio.c
index 81f4ee494a..d188bbc502 100644
--- a/libretro-common/formats/png/rpng_fbio.c
+++ b/libretro-common/formats/png/rpng_fbio.c
@@ -280,5 +280,8 @@ end:
       free(*data);
    free(rpng.idat_buf.data);
    free(rpng.process.inflate_buf);
+
+   if (rpng.process.stream)
+      zlib_stream_free(rpng.process.stream);
    return ret;
 }
diff --git a/libretro-common/formats/png/rpng_nbio.c b/libretro-common/formats/png/rpng_nbio.c
index 6ad2fd4475..19d1c52712 100644
--- a/libretro-common/formats/png/rpng_nbio.c
+++ b/libretro-common/formats/png/rpng_nbio.c
@@ -221,6 +221,8 @@ void rpng_nbio_load_image_free(struct rpng_t *rpng)
       free(rpng->idat_buf.data);
    if (rpng->process.inflate_buf)
       free(rpng->process.inflate_buf);
+   if (rpng->process.stream)
+      zlib_stream_free(rpng->process.stream);
 
    if (rpng)
       free(rpng);