Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8001


Ignore:
Timestamp:
Feb 28, 2011, 5:49:01 AM (14 years ago)
Author:
rgrieder
Message:

Fixed tiny memory leak.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/src/libraries/core/input/KeyBinder.cc

    r7891 r8001  
    431431                        // decrease counter
    432432                        button->nCommands_[mode_index]--;
    433                         // note: we don't replace the old array - it's not one element too large, but no one cares since nCommands_ defines the size
     433                        // old array would not get deleted if nCommands_ is now 0
     434                        // otherwise: nobody cares about an array that is one element too large - nCommands_ defines the size
     435                        if (button->nCommands_[mode_index] == 0)
     436                        {
     437                            delete[] button->commands_[mode_index];
     438                            button->nCommands_[mode_index] = 0;
     439                        }
    434440
    435441                        // decrement the index since we shifted the array and continue searching for more occurrences of the command
Note: See TracChangeset for help on using the changeset viewer.