@@ -548,8 +548,7 @@ static bool MCDeployToLinuxReadProgramHeaders(MCDeployFileRef p_file, typename T
548548template <typename T>
549549static bool MCDeployToLinuxReadString (MCDeployFileRef p_file, typename T::Shdr& p_string_header, uint32_t p_index, char *& r_string)
550550{
551- bool t_success;
552- t_success = true ;
551+ bool t_success = true ;
553552
554553 // First check that the index is valid
555554 if (p_index >= p_string_header . sh_size)
@@ -558,11 +557,9 @@ static bool MCDeployToLinuxReadString(MCDeployFileRef p_file, typename T::Shdr&
558557 // As the string table does not contain any string lengths and they are
559558 // just NUL terminated, we must gradually load portions until a NUL is
560559 // reached.
561- char *t_buffer;
562- uint32_t t_length;
563- t_buffer = NULL ;
564- t_length = 0 ;
565-
560+ char *t_buffer = nullptr ;
561+ uint32_t t_length = 0 ;
562+
566563 while (t_success)
567564 {
568565 // Compute how much data to read - this is either the fixed chunk
@@ -688,17 +685,15 @@ Exec_stat MCDeployToELF(const MCDeployParameters& p_params, bool p_is_android)
688685 t_payload_section = NULL ;
689686 for (uint32_t i = 0 ; t_success && i < t_header . e_shnum && t_project_section == NULL ; i++)
690687 {
691- char * t_section_name;
692- t_success = MCDeployToLinuxReadString<T>(t_engine, t_section_headers[t_header . e_shstrndx], t_section_headers[i] . sh_name, t_section_name);
688+ MCAutoPointer< char > t_section_name;
689+ t_success = MCDeployToLinuxReadString<T>(t_engine, t_section_headers[t_header . e_shstrndx], t_section_headers[i] . sh_name, & t_section_name);
693690
694691 // Notice that we compare 9 bytes, this is to ensure we match .project
695692 // only and not .project<otherchar> (i.e. we match the NUL char).
696- if (t_success && memcmp (t_section_name, " .project" , 9 ) == 0 )
693+ if (t_success && memcmp (* t_section_name, " .project" , 9 ) == 0 )
697694 t_project_section = &t_section_headers[i];
698- if (t_success && memcmp (t_section_name, " .payload" , 9 ) == 0 )
695+ if (t_success && memcmp (* t_section_name, " .payload" , 9 ) == 0 )
699696 t_payload_section = &t_section_headers[i];
700-
701- delete t_section_name;
702697 }
703698
704699 if (t_success && t_project_section == NULL )
0 commit comments