gst/: Fix memleak (#159215).

Original commit message from CVS:
Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
* gst-libs/gst/resample/resample.c: (gst_resample_close):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c:
Fix memleak (#159215).
This commit is contained in:
Ronald S. Bultje 2004-12-16 11:39:00 +00:00
parent d60c69f70c
commit 75035819b8
3 changed files with 29 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2004-12-16 Sebastien Cote <sc5@hermes.usherb.ca>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst-libs/gst/resample/resample.c: (gst_resample_close):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c:
Fix memleak (#159215).
2004-12-16 Toni Willberg <toniw@iki.fi> 2004-12-16 Toni Willberg <toniw@iki.fi>
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>

View file

@ -133,6 +133,22 @@ gst_resample_reinit (gst_resample_t * r)
} }
} }
void
gst_resample_close (gst_resample_t * r)
{
if (r->buffer) {
free (r->buffer);
r->buffer = NULL;
r->buffer_len = 0;
}
if (r->hack_union.s.out_tmp) {
free (r->hack_union.s.out_tmp);
r->hack_union.s.out_tmp = NULL;
r->hack_union.s.out_tmp_len = 0;
}
}
/* /*
* Prepare to be confused. * Prepare to be confused.
* *
@ -252,8 +268,7 @@ gst_resample_nearest_s16 (gst_resample_t * r)
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1); SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
break; break;
case 2: case 2:
SCALE_LOOP (o_ptr[0] = i_ptr[0]; SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
o_ptr[1] = i_ptr[1], 2);
break; break;
default: default:
{ {
@ -612,8 +627,7 @@ gst_resample_nearest_float (gst_resample_t * r)
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1); SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
break; break;
case 2: case 2:
SCALE_LOOP (o_ptr[0] = i_ptr[0]; SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
o_ptr[1] = i_ptr[1], 2);
break; break;
default: default:
{ {

View file

@ -98,7 +98,8 @@ void gst_resample_init(gst_resample_t *r);
void gst_resample_reinit(gst_resample_t *r); void gst_resample_reinit(gst_resample_t *r);
void gst_resample_close (gst_resample_t * r);
void gst_resample_scale(gst_resample_t *r, void *i_buf, unsigned int size); void gst_resample_scale(gst_resample_t *r, void *i_buf, unsigned int size);
#endif /* __GST_RESAMPLE_H__ */ #endif /* __GST_RESAMPLE_H__ */