-
Notifications
You must be signed in to change notification settings - Fork 35
Make sure TRACKER is not used after being destroyed #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Can you add some more info what problem is this solving? |
2fa0a88
to
05cd140
Compare
Added a comment and a commit description. |
LGTM |
src/provider/provider_tracking.c
Outdated
@@ -80,6 +80,8 @@ static umf_result_t umfMemoryTrackerRemove(umf_memory_tracker_handle_t hTracker, | |||
|
|||
umf_memory_pool_handle_t umfMemoryTrackerGetPool(const void *ptr) { | |||
assert(ptr); | |||
assert(TRACKER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don;t know if we should assert it. Creating memory tracker can fail for a few reasons, see here:
return NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with:
if (TRACKER == NULL) {
fprintf(stderr, "tracker is not created\n");
return NULL;
}
if (TRACKER->map == NULL) {
fprintf(stderr, "tracker's map is not created\n");
return NULL;
}
Done
Make sure TRACKER is not used after being destroyed. Also add checks to umfMemoryTrackerGetPool() to detect if TRACKER or its map is not initialized. Signed-off-by: Lukasz Dorau <[email protected]>
05cd140
to
68a9e16
Compare
Make sure TRACKER is not used after being destroyed.
Also add checks to umfMemoryTrackerGetPool()
to detect if TRACKER or its map is not initialized.