jpegenc: free/malloc instead of realloc, avoids memcpy

This commit is contained in:
Tim-Philipp Müller 2010-05-28 15:27:14 +01:00
parent e7ac799278
commit 100673bf14

View file

@ -520,11 +520,12 @@ gst_jpegenc_resync (GstJpegEnc * jpegenc)
jpegenc->h_samp[i], jpegenc->v_samp[i]);
jpegenc->cinfo.comp_info[i].h_samp_factor = jpegenc->h_samp[i];
jpegenc->cinfo.comp_info[i].v_samp_factor = jpegenc->v_samp[i];
jpegenc->line[i] = g_realloc (jpegenc->line[i],
jpegenc->v_max_samp * DCTSIZE * sizeof (char *));
g_free (jpegenc->line[i]);
jpegenc->line[i] = g_new (guchar *, jpegenc->v_max_samp * DCTSIZE);
if (!jpegenc->planar) {
for (j = 0; j < jpegenc->v_max_samp * DCTSIZE; j++) {
jpegenc->row[i][j] = g_realloc (jpegenc->row[i][j], width);
g_free (jpegenc->row[i][j]);
jpegenc->row[i][j] = g_malloc (width);
jpegenc->line[i][j] = jpegenc->row[i][j];
}
}