Commit ad658500 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Actually free the memory libvgz allocated to work in.

No wonder gzip support leaked memory...

Orginally this memory came from the the thread workspace so deallocation
was automatic.  Not so when we switched to malloc...
parent 72e08e2a
......@@ -80,6 +80,7 @@ SVNID("$Id$")
struct vgz {
unsigned magic;
#define VGZ_MAGIC 0x162df0cb
enum {VGZ_GZ,VGZ_UN} dir;
struct sess *sess;
const char *id;
struct ws *tmp;
......@@ -162,6 +163,7 @@ VGZ_NewUngzip(struct sess *sp, const char *id)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
vg = vgz_alloc_vgz(sp, id);
vg->dir = VGZ_UN;
VSC_main->n_gunzip++;
/*
......@@ -182,6 +184,7 @@ VGZ_NewGzip(struct sess *sp, const char *id)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
vg = vgz_alloc_vgz(sp, id);
vg->dir = VGZ_GZ;
VSC_main->n_gzip++;
/*
......@@ -380,6 +383,10 @@ VGZ_Destroy(struct vgz **vgp)
(intmax_t)vg->vz.stop_bit);
if (vg->tmp != NULL)
WS_Reset(vg->tmp, vg->tmp_snapshot);
if (vg->dir == VGZ_GZ)
AZ(deflateEnd(&vg->vz));
else
AZ(inflateEnd(&vg->vz));
FREE_OBJ(vg);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment