Skip to content
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

String returned by value must be stored #2877

Merged
merged 1 commit into from Mar 17, 2014

Conversation

wmtan
Copy link
Contributor

@wmtan wmtan commented Mar 15, 2014

This is a fix for a valgrind error discovered by Vincenzo Innocente. The function TypeWithDict::name() returns a string by value. A caller of this function, the free function typeCode(), saved the value of the char* to the embedded C string without saving the string itself. In those cases where TypeWithDict returns a temporary (as it will when the type is a pointer), the stored char* gets used after the temporary string is reclaimed. The fault is in the caller. This pull request has the caller save the returned string on the stack so that it does not get prematurely reclaimed.
This problem was introduced in 7_0_X. A separate pull request will be issued for 7_0_X.

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @wmtan for CMSSW_7_1_X.

String returned by value must be stored

It involves the following packages:

CommonTools/Utils

@nclopezo, @monttj, @cmsbuild, @anton-a, @thspeer, @slava77, @vadler, @Degano can you please review it and eventually sign? Thanks.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.
@nclopezo, @ktf you are the release manager for this.
You can merge this pull request by typing 'merge' in the first line of your comment.

@cmsbuild
Copy link
Contributor

@ktf
Copy link
Contributor

ktf commented Mar 17, 2014

Bypassing reco and analysis. Shout if not ok.

ktf added a commit that referenced this pull request Mar 17, 2014
Valgrind fix -- String returned by value must be stored
@ktf ktf merged commit c39d1f5 into cms-sw:CMSSW_7_1_X Mar 17, 2014
@wmtan wmtan deleted the FixForValgrindInvalidRead branch May 9, 2014 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants