GitLab has been upgraded to 13.7.4 If you encounter any issues mail code@riscosopen.org

Commit 1dda9cac authored by Robert Sprowson's avatar Robert Sprowson

Fix potential memory leak on malloc failure

Do the claim in 1 step, to save time and save leaking if one of them fails.
Ref https://www.riscosopen.org/forum/forums/4/topics/9503

Version 3.25. Tagged as 'Help2-3_25'
parent a404ce4c
/* (3.24)
/* (3.25)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.24
#define Module_MajorVersion_CMHG 3.25
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 Jul 2017
#define Module_Date_CMHG 08 Oct 2017
#define Module_MajorVersion "3.24"
#define Module_Version 324
#define Module_MajorVersion "3.25"
#define Module_Version 325
#define Module_MinorVersion ""
#define Module_Date "23 Jul 2017"
#define Module_Date "08 Oct 2017"
#define Module_ApplicationDate "23-Jul-17"
#define Module_ApplicationDate "08-Oct-17"
#define Module_ComponentName "Help2"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Help2"
#define Module_FullVersion "3.24"
#define Module_HelpVersion "3.24 (23 Jul 2017)"
#define Module_LibraryVersionInfo "3:24"
#define Module_FullVersion "3.25"
#define Module_HelpVersion "3.25 (08 Oct 2017)"
#define Module_LibraryVersionInfo "3:25"
......@@ -227,9 +227,9 @@ static _kernel_oserror* update_help_box(char* string, int length)
error_trap(toolbox_hide_object(0, shadow_id), 0);
/* Get memory to store expanded help message */
expanded_string = malloc(1024);
buffer = malloc(1024);
if ((!expanded_string) || (!buffer)) return common_error(messages_lookup("Error4"));
buffer = malloc(1024 + 1024);
if (!buffer) return common_error(messages_lookup("Error4"));
expanded_string = &buffer[1024];
/* Break the help message down into lines which will be displayed in the box */
num_strings = translate_help_string(help_box_message, expanded_string, length);
......@@ -323,7 +323,6 @@ static _kernel_oserror* update_help_box(char* string, int length)
help_box_showing = 1;
free(buffer);
free(expanded_string);
return NULL;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment