Skip to content

Commit

Permalink
Merge pull request #2186 from undergraver/master
Browse files Browse the repository at this point in the history
#2180 don't use invalid references of temporary objects - scan-build report
  • Loading branch information
jwillemsen authored Jan 29, 2024
2 parents 45e37d9 + 0c991b2 commit 3daae58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ACE/ace/OS_NS_stdio.inl
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,11 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx)
# endif /* ACE_HAS_NONCONST_TEMPNAM */
#else /* ACE_LACKS_TEMPNAM */
// No native wide-char support; convert to narrow and call the char* variant.
char *ndir = ACE_Wide_To_Ascii (dir).char_rep ();
char *npfx = ACE_Wide_To_Ascii (pfx).char_rep ();
ACE_Wide_To_Ascii wta_ndir(dir);
char *ndir = wta_ndir.char_rep ();

ACE_Wide_To_Ascii wta_npfx(pfx);
char *npfx = wta_npfx.char_rep ();
char *name = ACE_OS::tempnam (ndir, npfx);
// ACE_OS::tempnam returns a pointer to a malloc()-allocated space.
// Convert that string to wide-char and free() the original.
Expand Down

0 comments on commit 3daae58

Please sign in to comment.