tSanity check: don't call g_memmove with size=0, in case it does something dumb. - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit cc1a291a6612b1827661efce49266aedff9fd15b
(DIR) parent 042c82570e7df175a373eb93ada6b2c5b8737e5d
(HTM) Author: Ben Webb <ben@salilab.org>
Date: Thu, 25 Apr 2002 16:27:08 +0000
Sanity check: don't call g_memmove with size=0, in case it does something dumb.
Diffstat:
M src/dopewars.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/src/dopewars.c b/src/dopewars.c
t@@ -1374,8 +1374,10 @@ void RemoveListEntry(DopeList *List, int Index)
if (!List || Index < 0 || Index >= List->Number)
return;
- g_memmove(&(List->Data[Index]), &(List->Data[Index + 1]),
- (List->Number - 1 - Index) * sizeof(DopeEntry));
+ if (Index < List->Number - 1) {
+ g_memmove(&(List->Data[Index]), &(List->Data[Index + 1]),
+ (List->Number - 1 - Index) * sizeof(DopeEntry));
+ }
List->Number--;
List->Data = (DopeEntry *)g_realloc(List->Data, List->Number *
sizeof(DopeEntry));