Changeset 5740
- Timestamp:
- 06/20/09 12:04:52 (4 years ago)
- Location:
- lm-sensors/trunk
- Files:
-
- 9 modified
-
CHANGES (modified) (2 diffs)
-
doc/libsensors-API.txt (modified) (1 diff)
-
lib/data.c (modified) (1 diff)
-
lib/libsensors.3 (modified) (2 diffs)
-
lib/sensors.h (modified) (2 diffs)
-
prog/sensord/args.c (modified) (2 diffs)
-
prog/sensord/sensord.c (modified) (3 diffs)
-
prog/sensord/sensord.h (modified) (1 diff)
-
prog/sensors/main.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lm-sensors/trunk/CHANGES
r5737 r5740 6 6 isaset: Use geteuid instead of getuid so that setuid bit works 7 7 libsensors: Don't rely on dirent->dt_type being set 8 New method to free the memory allocated for chip names 8 9 Makefile: Include generated source files in dependency checking 9 10 Make it possible to skip building of the static library … … 17 18 Disable unit scaling for fan speeds 18 19 Use daemon logging facility instead of local4 by default 20 Fix a memory leak when a chip name is provided 21 sensors: Fix a memory leak when a chip name is provided 19 22 sensors-detect: Add nNidia nForce MCP78S SMBus detection 20 23 Display Super-I/O address even if LD is disabled -
lm-sensors/trunk/doc/libsensors-API.txt
r5663 r5740 6 6 authors can quickly figure out how to test for the availability of a 7 7 given new feature. 8 9 0x420 lm-sensors 3.1.1 10 * Added a method to free the memory allocated by sensors_parse_chip_name() 11 void sensors_free_chip_name(sensors_chip_name *chip); 8 12 9 13 0x410 lm-sensors 3.1.0 -
lm-sensors/trunk/lib/data.c
r5674 r5740 54 54 int sensors_proc_bus_count = 0; 55 55 int sensors_proc_bus_max = 0; 56 57 void sensors_free_chip_name(sensors_chip_name *chip) 58 { 59 free(chip->prefix); 60 } 56 61 57 62 /* -
lm-sensors/trunk/lib/libsensors.3
r5654 r5740 43 43 .BI "int sensors_parse_chip_name(const char *" orig_name "," 44 44 .BI " sensors_chip_name *" res ");" 45 .BI "void sensors_free_chip_name(sensors_chip_name *" chip ");" 45 46 .BI "int sensors_snprintf_chip_name(char *" str ", size_t " size "," 46 47 .BI " const sensors_chip_name *" chip ");" … … 102 103 .B sensors_parse_chip_name() 103 104 parses a chip name to the internal representation. Return 0 on success, 104 <0 on error. 105 <0 on error. Make sure to call sensors_free_chip_name() when you're done 106 with the data. 107 108 .B sensors_free_chip_name() 109 frees the memory that may have been allocated for the internal 110 representation of a chip name. You only have to call this for chip 111 names which do not originate from libsensors itself (that is, chip 112 names which were generated by sensors_parse_chip_name()). 105 113 106 114 .B sensors_snprintf_chip_name() -
lm-sensors/trunk/lib/sensors.h
r5663 r5740 32 32 API additions like new flags / enum values. The second digit is for tracking 33 33 larger additions like new methods. */ 34 #define SENSORS_API_VERSION 0x4 1034 #define SENSORS_API_VERSION 0x420 35 35 36 36 #define SENSORS_CHIP_NAME_PREFIX_ANY NULL … … 80 80 on error. */ 81 81 int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res); 82 83 /* Free memory allocated for the internal representation of a chip name. */ 84 void sensors_free_chip_name(sensors_chip_name *chip); 82 85 83 86 /* Print a chip name from its internal representation. Note that chip should -
lm-sensors/trunk/prog/sensord/args.c
r5737 r5740 256 256 fprintf(stderr, "Invalid chip name `%s': %s\n", arg, 257 257 sensors_strerror(err)); 258 for (i--; i >= 0; i--) 259 sensors_free_chip_name(sensord_args.chipNames + i); 258 260 return -1; 259 261 } … … 263 265 return 0; 264 266 } 267 268 void freeChips() 269 { 270 int i; 271 272 for (i = 0; i < sensord_args.numChipNames; i++) 273 sensors_free_chip_name(sensord_args.chipNames + i); 274 } -
lm-sensors/trunk/prog/sensord/sensord.c
r5734 r5740 234 234 exit(EXIT_FAILURE); 235 235 236 if (loadLib(sensord_args.cfgFile)) 237 exit(EXIT_FAILURE); 236 if (loadLib(sensord_args.cfgFile)) { 237 freeChips(); 238 exit(EXIT_FAILURE); 239 } 238 240 239 241 if (!sensord_args.doCGI) … … 242 244 if (sensord_args.rrdFile) { 243 245 ret = rrdInit(); 244 if (ret) 246 if (ret) { 247 freeChips(); 245 248 exit(EXIT_FAILURE); 249 } 246 250 } 247 251 … … 254 258 } 255 259 260 freeChips(); 256 261 if (unloadLib()) 257 262 exit(EXIT_FAILURE); -
lm-sensors/trunk/prog/sensord/sensord.h
r5736 r5740 32 32 extern int parseArgs(int argc, char **argv); 33 33 extern int parseChips(int argc, char **argv); 34 extern void freeChips(void); 34 35 35 36 /* from lib.c */ -
lm-sensors/trunk/prog/sensors/main.c
r5632 r5740 335 335 } 336 336 cnt += do_the_real_work(&chip, &err); 337 sensors_free_chip_name(&chip); 337 338 } 338 339
