err->ekind = ekind;
err->addr = a;
err->extra = extra;
- if (s) {
- err->string = VG_(arena_strdup)( VG_AR_ERRORS, s );
- }
- else {
- err->string = NULL;
- }
+ err->string = s;
+
/* sanity... */
vg_assert( tid < VG_N_THREADS );
}
}
/* Build ourselves the error */
- err.string = NULL;
construct_error ( &err, tid, ekind, a, s, extra, NULL );
/* First, see if we've got an error record matching this one. */
vg_errors = p;
}
- /* Free err.string, if we allocated it. */
- if (err.string) {
- VG_(arena_free)( VG_AR_ERRORS, err.string );
- err.string = NULL; /* paranoia */
- }
-
return;
}
p_prev = p;
// This one not passed a ThreadId, so it grabs it itself.
void MAC_(record_overlap_error) ( Char* function )
{
+ static Int n_strdups = 0;
MAC_Error err_extra;
+
+ /* Potential space leak; this strdup'd space is never
+ reclaimed. Hence hacky sanity check. */
+ if (n_strdups < 1000) {
+ n_strdups++;
+ function = VG_(strdup) ( function );
+ } else {
+ function = NULL;
+ }
MAC_(clear_MAC_Error)( &err_extra );
VG_(maybe_record_error)( VG_(get_current_or_recent_tid)(),
- OverlapErr, /*addr*/0, function, &err_extra );
+ OverlapErr, /*addr*/0, /*s*/function, &err_extra );
}