Show
Ignore:
Timestamp:
06/20/09 11:53:23 (5 years ago)
Author:
khali
Message:

sensord, sensors: Fix a memory leak when one or more chip names are
provided on the command line.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-2.10/prog/sensord/args.c

    r4821 r5738  
    299299      if ((err = sensors_parse_chip_name (arg, chipNames + i))) { 
    300300        fprintf (stderr, "Invalid chip name `%s': %s\n", arg, sensors_strerror (err)); 
     301        for (-- i; i >= 0; -- i) 
     302          free (chipNames[i].prefix); 
    301303        return -1; 
    302304      } 
     
    306308  return 0; 
    307309} 
     310 
     311void 
     312freeChips 
     313() { 
     314  int i; 
     315  for (i = 0; i < numChipNames; ++ i) 
     316    free (chipNames[i].prefix); 
     317}