Changeset f8bdd12 in rtems


Ignore:
Timestamp:
Nov 9, 2015, 6:30:00 PM (4 years ago)
Author:
Gedare Bloom <gedare@…>
Branches:
master
Children:
4fee129
Parents:
1d55e15
git-author:
Gedare Bloom <gedare@…> (11/09/15 18:30:00)
git-committer:
Gedare Bloom <gedare@…> (11/09/15 18:42:04)
Message:

gpio: free memory in error path

Updates #2462.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/gpio.c

    r1d55e15 rf8bdd12  
    17091709  }
    17101710
    1711   interrupt_state = gpio_pin_state[pin_number].interrupt_state;
    1712 
    17131711  /* If an interrupt configuration is already in place for this pin. */
    1714   if ( interrupt_state != NULL ) {
     1712  if ( gpio_pin_state[pin_number].interrupt_state != NULL ) {
    17151713    RELEASE_LOCK(gpio_bank_state[bank].lock);
    17161714
     
    17251723  }
    17261724
    1727   gpio_pin_state[pin_number].interrupt_state->active_interrupt = NONE;
    1728   gpio_pin_state[pin_number].interrupt_state->debouncing_tick_count = 0;
    1729   gpio_pin_state[pin_number].interrupt_state->last_isr_tick = 0;
    1730 
    1731   rtems_chain_initialize_empty(
    1732     &gpio_pin_state[pin_number].interrupt_state->handler_chain
    1733   );
    1734 
    17351725  interrupt_state = gpio_pin_state[pin_number].interrupt_state;
     1726  interrupt_state->active_interrupt = NONE;
     1727  interrupt_state->debouncing_tick_count = 0;
     1728  interrupt_state->last_isr_tick = 0;
     1729
     1730  rtems_chain_initialize_empty( &interrupt_state->handler_chain );
    17361731
    17371732  interrupt_state->active_interrupt = interrupt;
     
    17431738
    17441739  if ( sc != RTEMS_SUCCESSFUL ) {
     1740    free(interrupt_state);
     1741    gpio_pin_state[pin_number].interrupt_state = NULL;
    17451742    RELEASE_LOCK(gpio_bank_state[bank].lock);
    17461743
Note: See TracChangeset for help on using the changeset viewer.