summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/dalvik/register.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/dalvik/register.c b/plugins/dalvik/register.c
index 0833650..8374e75 100644
--- a/plugins/dalvik/register.c
+++ b/plugins/dalvik/register.c
@@ -85,7 +85,7 @@ GDalvikRegister *_g_dalvik_register_new(uint16_t);
/* Conservation des registres utilisés */
static GDalvikRegister **_dalvik_registers = NULL;
-static uint16_t _dreg_count = 0;
+static size_t _dreg_count = 0;
G_LOCK_DEFINE_STATIC(_dreg_mutex);
@@ -361,18 +361,21 @@ int g_dalvik_register_compare(const GDalvikRegister *a, const GDalvikRegister *b
static GDalvikRegister *get_dalvik_register(uint16_t index)
{
GDalvikRegister *result; /* Structure à retourner */
- uint16_t i; /* Boucle de parcours */
+ size_t new_count; /* Nouvelle taille à considérer*/
+ size_t i; /* Boucle de parcours */
G_LOCK(_dreg_mutex);
if (index >= _dreg_count)
{
- _dalvik_registers = realloc(_dalvik_registers, (index + 1) * sizeof(GDalvikRegister *));
+ new_count = index + 1;
- for (i = _dreg_count; i < (index + 1); i++)
+ _dalvik_registers = realloc(_dalvik_registers, new_count * sizeof(GDalvikRegister *));
+
+ for (i = _dreg_count; i < new_count; i++)
_dalvik_registers[i] = NULL;
- _dreg_count = index + 1;
+ _dreg_count = new_count;
}
@@ -404,7 +407,7 @@ static GDalvikRegister *get_dalvik_register(uint16_t index)
void clean_dalvik_register_cache(void)
{
- uint16_t i; /* Boucle de parcours */
+ size_t i; /* Boucle de parcours */
G_LOCK(_dreg_mutex);