Commit 71066a48 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix NULL pointer assignment, realloc mistake

dragdrop.c: In dragdrop_scroll, don't write 0 to address 0 when 'removeptr' is NULL, as it often is.
registry.c: If realloc() fails, don't lose track of 'list' and leak the memory.
Found by cpp check static analysis.
dragdrop.c: Squash a couple of C99 prototype warnings.

Version 1.13. Tagged as 'WinEdit-1_13'
parent 20bf3810
/* (1.12)
/* (1.13)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.12
#define Module_MajorVersion_CMHG 1.13
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 22 Aug 2017
#define Module_Date_CMHG 11 Aug 2018
#define Module_MajorVersion "1.12"
#define Module_Version 112
#define Module_MajorVersion "1.13"
#define Module_Version 113
#define Module_MinorVersion ""
#define Module_Date "22 Aug 2017"
#define Module_Date "11 Aug 2018"
#define Module_ApplicationDate "22-Aug-17"
#define Module_ApplicationDate "11-Aug-18"
#define Module_ComponentName "WinEdit"
#define Module_ComponentPath "castle/RiscOS/Utilities/WinEdit"
#define Module_FullVersion "1.12"
#define Module_HelpVersion "1.12 (22 Aug 2017)"
#define Module_LibraryVersionInfo "1:12"
#define Module_FullVersion "1.13"
#define Module_HelpVersion "1.13 (11 Aug 2018)"
#define Module_LibraryVersionInfo "1:13"
......@@ -42,7 +42,7 @@ static DragDropCallbackRec dd;
* Reset the mouse pointer to its default
*/
static void reset_pointer ()
static void reset_pointer (void)
{
(void) _swix(Wimp_SetPointerShape, _INR(0,1),
1, -1);
......@@ -324,13 +324,13 @@ static error * dragdrop_offer (int windowhandle, MessageDraggingPtr msg)
* Return the claimant's reference, or 0 if unclaimed.
*/
int dragdrop_claimref ()
int dragdrop_claimref (void)
{
return claimref;
}
int dragdrop_claimwin ()
int dragdrop_claimwin (void)
{
return claimwin;
}
......@@ -344,7 +344,7 @@ int dragdrop_claimwin ()
* of the transaction.
*/
error * dragdrop_cancel ()
error * dragdrop_cancel (void)
{
dprintf ("(Receive Cancelled).");
if (claimref)
......@@ -496,7 +496,7 @@ Bool dragdrop_scroll (WindowPtr win, PointPtr position, Bool *removeptr)
return NULL;
}
*removeptr = FALSE;
if (removeptr) *removeptr = FALSE;
/* Decide if auto-scroll might be appropriate */
if (mouseposvalid)
......
......@@ -50,11 +50,17 @@ error * registry_register_window (int handle, RegistryType type, void *closure)
return NULL;
}
if (listused >= listlen)
list = realloc (list, sizeof(RegistryRec) * (listlen += DELTA));
if (list == NULL)
{
listlen = listused = 0;
return error_lookup ("NoMem");
RegistryPtr listextd;
listextd = realloc (list, sizeof(RegistryRec) * (listlen += DELTA));
if (listextd == NULL)
{
free (list);
listlen = listused = 0;
return error_lookup ("NoMem");
}
list = listextd;
}
list[listused].used = TRUE;
list[listused].handle = handle;
......
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