Bug 218741 - [PATCH] Memcheck does not detect malloc/new/new[] mismatches in applications with custom allocators
Summary: [PATCH] Memcheck does not detect malloc/new/new[] mismatches in applications ...
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-15 01:33 UTC by Steve VanDeBogart
Modified: 2009-12-15 17:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Add new-like and new[]-like block client requests. (15.11 KB, patch)
2009-12-15 01:37 UTC, Steve VanDeBogart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve VanDeBogart 2009-12-15 01:33:32 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

The client request VG_USERREQ__MALLOCLIKE_BLOCK does not allow the caller to specify the allocation type (malloc,new,new[]) and therefore memcheck can not detect mismatches between the allocation and free type.

A prime example of where this is a problem is in bug 217615 (http://bugs.kde.org/show_bug.cgi?id=217615)

One likely reason that this isn't already implemented is that the MC_Chunk structure is short on space to store addition state.

Attached is a patch that adds additional user requests to mark block as new-like and new[]-like.  It steals a bit from ExeContext in order to store the additional state.
Comment 1 Steve VanDeBogart 2009-12-15 01:37:23 UTC
Created attachment 39060 [details]
Add new-like and new[]-like block client requests.

Add new-like and new[]-like block client requests.  (C) Google.