Skip to content

pmix: fix misc memory leaks involving opal_convert_jobid_to_string #1296

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

ggouaillardet
Copy link
Contributor

No description provided.

@ggouaillardet
Copy link
Contributor Author

@rhc54 i initially prepared this PR in order to fix misc memory leaks
opal_convert_jobid_to_string allocates the result via asprintf but it is never released.

then i found that except in _cnt from orte/orted/pmix/pmix_server_dyn.c, we only use the result of this function as a parameter of snprintf.
bottom line, and though this is clearly not in the critical path, that is pretty unefficient and require extra code to free the allocated memory.

wouldn't it be better to replace opal_convert_jobid_to_string with opal_snprintf_jobid
and update _cnt accordingly (e.g. use a char jobid[xxx]; like local variable ) ?

i can make a new PR if you agree this is the way to go

@rhc54
Copy link
Contributor

rhc54 commented Jan 13, 2016

@ggouaillardet I agree with your alternate approach - there are multiple places in the code base where that would be a better. Problem is to figure out a reasonable max size - right now, for OMPI internals, something like 64 or 128 characters would be fine.

@ggouaillardet
Copy link
Contributor Author

@rhc54 i did that in #1302
now closing this PR

jsquyres pushed a commit to jsquyres/ompi that referenced this pull request Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants