From: Jan P. <pa...@pi...> - 2008-02-15 07:05:07
|
Lutz, to be absolutely correct, you should not update *ds if the realloc fails. Then the code can easily touch memory beyond allocated area... (IMHO harder to find than eventually touching NULL.) Similarly in *most* your fixes (I wouldn't bother *much* when actually decreasing the allocated size). > file: /cvsroot/libexif/libexif/libexif/exif-data.c,v > if (s & 1) > (*ds)++; > - *d = exif_mem_realloc (data->priv->mem, *d, *ds); > - if (!*d) { > + t = exif_mem_realloc (data->priv->mem, *d, *ds); > + if (!t) { > EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", *ds); > return; > } > + *d = t; --- Jan |