Changeset 01dbb0d0a665cdb6625e6290da3405ee89ddc80b
- Timestamp:
- 04/27/08 01:17:08
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1209259028 +0000
- git-parent:
[4c05448ea043aaf96b94270f68092553c96ccd9d]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1209259028 +0000
- Message:
various valgrind noted leaks
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r4be21f8 |
r01dbb0d |
|
| 56 | 56 | ;; |
|---|
| 57 | 57 | *-*-linux*) |
|---|
| 58 | | CPPFLAGS="$CPPFLAGS -D__USE_XOPEN" |
|---|
| | 58 | LDFLAGS="$LDFLAGS -Wl,-E" |
|---|
| | 59 | CPPFLAGS="$CPPFLAGS" |
|---|
| 59 | 60 | PICFLAGS="-fpic" |
|---|
| 60 | 61 | MODULELD="$CC -shared" |
|---|
| … | … | |
| 228 | 229 | sys/ioctl_compat.h util.h sys/time.h sys/mman.h) |
|---|
| 229 | 230 | |
|---|
| | 231 | AC_CACHE_CHECK([for epoll support], ac_cv_have_epoll, [ |
|---|
| | 232 | AC_TRY_LINK( |
|---|
| | 233 | [ #include <sys/types.h> ], |
|---|
| | 234 | [ u_int a; a = epoll_create(); ], |
|---|
| | 235 | [ ac_cv_have_epoll="yes" ], |
|---|
| | 236 | [ ac_cv_have_epoll="no" ] |
|---|
| | 237 | ) |
|---|
| | 238 | ]) |
|---|
| | 239 | if test "x$ac_cv_have_epoll" = "xyes" ; then |
|---|
| | 240 | AC_DEFINE(HAVE_EPOLL) |
|---|
| | 241 | EVENTER_OBJS="$EVENTER_OBJS eventer_epoll_impl.o" |
|---|
| | 242 | AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "epoll") |
|---|
| | 243 | have_epoll=1 |
|---|
| | 244 | fi |
|---|
| | 245 | |
|---|
| 230 | 246 | AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [ |
|---|
| 231 | 247 | AC_TRY_LINK( |
|---|
| … | … | |
| 239 | 255 | AC_DEFINE(HAVE_KQUEUE) |
|---|
| 240 | 256 | EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.o" |
|---|
| | 257 | AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "kqueue") |
|---|
| 241 | 258 | have_kqueue=1 |
|---|
| 242 | 259 | fi |
|---|
| r4c05448 |
r01dbb0d |
|
| 118 | 118 | conf->results = serf_log_results; |
|---|
| 119 | 119 | noit_module_set_userdata(self, conf); |
|---|
| 120 | | return 0; |
|---|
| | 120 | return 1; |
|---|
| 121 | 121 | } |
|---|
| 122 | 122 | static int resmon_config(noit_module_t *self, noit_hash_table *options) { |
|---|
| … | … | |
| 137 | 137 | conf->results = resmon_log_results; |
|---|
| 138 | 138 | noit_module_set_userdata(self, conf); |
|---|
| 139 | | return 0; |
|---|
| | 139 | return 1; |
|---|
| 140 | 140 | } |
|---|
| 141 | 141 | static void generic_log_results(noit_module_t *self, noit_check_t *check) { |
|---|
| … | … | |
| 224 | 224 | current.state = strcmp(value,"OK") ? NP_BAD : NP_GOOD; |
|---|
| 225 | 225 | } |
|---|
| | 226 | xmlFree(value); |
|---|
| 226 | 227 | } |
|---|
| | 228 | xmlXPathFreeObject(pobj); |
|---|
| 227 | 229 | } |
|---|
| 228 | 230 | xmlXPathFreeContext(xpath_ctxt); |
|---|
| … | … | |
| 234 | 236 | rci->resmod, rci->resserv, current.status); |
|---|
| 235 | 237 | noit_check_set_stats(self, check, ¤t); |
|---|
| | 238 | free(current.status); |
|---|
| 236 | 239 | } |
|---|
| 237 | 240 | static void resmon_part_log_results(noit_module_t *self, noit_check_t *check, |
|---|
| … | … | |
| 309 | 312 | xpath_ctxt->node = node; |
|---|
| 310 | 313 | sobj = xmlXPathEval((xmlChar *)"@module", xpath_ctxt); |
|---|
| 311 | | resmod = (char *)xmlXPathCastNodeSetToString(sobj->nodesetval); |
|---|
| | 314 | if(sobj) { |
|---|
| | 315 | resmod = (char *)xmlXPathCastNodeSetToString(sobj->nodesetval); |
|---|
| | 316 | xmlXPathFreeObject(sobj); |
|---|
| | 317 | } |
|---|
| 312 | 318 | sobj = xmlXPathEval((xmlChar *)"@service", xpath_ctxt); |
|---|
| 313 | | resserv = (char *)xmlXPathCastNodeSetToString(sobj->nodesetval); |
|---|
| | 319 | if(sobj) { |
|---|
| | 320 | resserv = (char *)xmlXPathCastNodeSetToString(sobj->nodesetval); |
|---|
| | 321 | xmlXPathFreeObject(sobj); |
|---|
| | 322 | } |
|---|
| 314 | 323 | if(!resmod && !resserv) continue; |
|---|
| 315 | 324 | |
|---|
| … | … | |
| 319 | 328 | attrnode = xmlXPathNodeSetItem(sobj->nodesetval, 0); |
|---|
| 320 | 329 | value = (char *)xmlXPathCastNodeToString(attrnode); |
|---|
| | 330 | xmlXPathFreeObject(sobj); |
|---|
| 321 | 331 | snprintf(attr, sizeof(attr), "%s`%s`%s", |
|---|
| 322 | 332 | resmod, resserv, (char *)attrnode->name); |
|---|
| … | … | |
| 334 | 344 | break; |
|---|
| 335 | 345 | } |
|---|
| | 346 | xmlFree(value); |
|---|
| 336 | 347 | } |
|---|
| | 348 | if(resmod) xmlFree(resmod); |
|---|
| | 349 | if(resserv) xmlFree(resserv); |
|---|
| 337 | 350 | } |
|---|
| 338 | 351 | } |
|---|
| r1b3ee6a |
r01dbb0d |
|
| 266 | 266 | fd_set fdset; |
|---|
| 267 | 267 | int fds, block = 0; |
|---|
| 268 | | struct timeval timeout; |
|---|
| | 268 | struct timeval timeout = { 0, 0 }; |
|---|
| 269 | 269 | struct target_session *ts = closure; |
|---|
| 270 | 270 | FD_ZERO(&fdset); |
|---|
| r4b96846 |
r01dbb0d |
|
| 187 | 187 | noitL(noit_debug, "loaded uuid: %s\n", uuid_str); |
|---|
| 188 | 188 | } |
|---|
| 189 | | } |
|---|
| | 189 | |
|---|
| | 190 | noit_hash_destroy(options, free, free); |
|---|
| | 191 | free(options); |
|---|
| | 192 | } |
|---|
| | 193 | if(sec) free(sec); |
|---|
| 190 | 194 | } |
|---|
| 191 | 195 | |
|---|
| … | … | |
| 491 | 495 | free(m->metric_name); |
|---|
| 492 | 496 | if(m->metric_value.i) free(m->metric_value.i); |
|---|
| | 497 | free(m); |
|---|
| 493 | 498 | } |
|---|
| 494 | 499 | |
|---|
| … | … | |
| 541 | 546 | if(cp > s && *cp == '%') *cp-- = '\0'; /* chop a last % is there is one */ |
|---|
| 542 | 547 | |
|---|
| 543 | | while(*trailer && isspace(*trailer)) *trailer++; /* rtrim */ |
|---|
| | 548 | while(*trailer && isspace(*trailer)) *trailer++ = '\0'; /* rtrim */ |
|---|
| 544 | 549 | |
|---|
| 545 | 550 | /* string was ' -1.23e-01% inodes used ' */ |
|---|
| r4c05448 |
r01dbb0d |
|
| 134 | 134 | strdup((char *)node->name), strlen((char *)node->name), |
|---|
| 135 | 135 | strdup(value), free, free); |
|---|
| | 136 | xmlFree(value); |
|---|
| 136 | 137 | } |
|---|
| 137 | 138 | out: |
|---|
| … | … | |
| 255 | 256 | const char *path, char **value) { |
|---|
| 256 | 257 | char *str; |
|---|
| 257 | | int i; |
|---|
| 258 | | xmlXPathObjectPtr pobj; |
|---|
| | 258 | int i, rv = 1; |
|---|
| | 259 | xmlXPathObjectPtr pobj = NULL; |
|---|
| 259 | 260 | xmlXPathContextPtr current_ctxt; |
|---|
| 260 | 261 | xmlNodePtr current_node = (xmlNodePtr)section; |
|---|
| … | … | |
| 284 | 285 | if(noit_hash_retrieve(&_compiled_fallback, |
|---|
| 285 | 286 | path, strlen(path), (void **)&str)) { |
|---|
| 286 | | *value = str; |
|---|
| | 287 | *value = (char *)xmlStrdup((xmlChar *)str); |
|---|
| 287 | 288 | goto found; |
|---|
| 288 | 289 | } |
|---|
| | 290 | rv = 0; |
|---|
| | 291 | found: |
|---|
| | 292 | if(pobj) xmlXPathFreeObject(pobj); |
|---|
| 289 | 293 | if(current_ctxt && current_ctxt != xpath_ctxt) |
|---|
| 290 | 294 | xmlXPathFreeContext(current_ctxt); |
|---|
| 291 | | return 0; |
|---|
| 292 | | found: |
|---|
| 293 | | if(current_ctxt && current_ctxt != xpath_ctxt) |
|---|
| 294 | | xmlXPathFreeContext(current_ctxt); |
|---|
| 295 | | return 1; |
|---|
| | 295 | return rv; |
|---|
| 296 | 296 | } |
|---|
| 297 | 297 | int noit_conf_get_uuid(noit_conf_section_t section, |
|---|
| … | … | |
| 309 | 309 | if(_noit_conf_get_string(section,NULL,path,&str)) { |
|---|
| 310 | 310 | *value = strdup(str); |
|---|
| | 311 | xmlFree(str); |
|---|
| 311 | 312 | return 1; |
|---|
| 312 | 313 | } |
|---|
| … | … | |
| 318 | 319 | if(_noit_conf_get_string(section,NULL,path,&str)) { |
|---|
| 319 | 320 | strlcpy(buf, str, len); |
|---|
| | 321 | xmlFree(str); |
|---|
| 320 | 322 | return 1; |
|---|
| 321 | 323 | } |
|---|
| … | … | |
| 340 | 342 | } |
|---|
| 341 | 343 | longval = strtol(str, NULL, base); |
|---|
| | 344 | xmlFree(str); |
|---|
| 342 | 345 | *value = (int)longval; |
|---|
| 343 | 346 | return 1; |
|---|
| … | … | |
| 356 | 359 | if(_noit_conf_get_string(section,NULL,path,&str)) { |
|---|
| 357 | 360 | *value = atof(str); |
|---|
| | 361 | xmlFree(str); |
|---|
| 358 | 362 | return 1; |
|---|
| 359 | 363 | } |
|---|
| … | … | |
| 373 | 377 | !strcasecmp(str, "on")) *value = noit_true; |
|---|
| 374 | 378 | else *value = noit_false; |
|---|
| | 379 | xmlFree(str); |
|---|
| 375 | 380 | return 1; |
|---|
| 376 | 381 | } |
|---|
| ra504323 |
r01dbb0d |
|
| 322 | 322 | ssl = noit_false; |
|---|
| 323 | 323 | |
|---|
| 324 | | sslconfig = noit_conf_get_hash(listener_configs[i], "sslconfig"); |
|---|
| | 324 | sslconfig = ssl ? |
|---|
| | 325 | noit_conf_get_hash(listener_configs[i], "sslconfig") : |
|---|
| | 326 | NULL; |
|---|
| 325 | 327 | config = noit_conf_get_hash(listener_configs[i], "config"); |
|---|
| 326 | 328 | |
|---|
| 327 | 329 | noit_listener(address, port, SOCK_STREAM, backlog, |
|---|
| 328 | | ssl ? sslconfig : NULL, config, f, NULL); |
|---|
| | 330 | sslconfig, config, f, NULL); |
|---|
| 329 | 331 | } |
|---|
| 330 | 332 | } |
|---|
| r4dccf83 |
r01dbb0d |
|
| 106 | 106 | config = noit_conf_get_hash(sections[i], "config"); |
|---|
| 107 | 107 | module = noit_module_lookup(module_name); |
|---|
| 108 | | if(module->config && module->config(module, config)) { |
|---|
| 109 | | noitL(noit_stderr, |
|---|
| 110 | | "Configure failed on %s:%s\n", module_file, module_name); |
|---|
| 111 | | continue; |
|---|
| | 108 | if(module->config) { |
|---|
| | 109 | int rv; |
|---|
| | 110 | rv = module->config(module, config); |
|---|
| | 111 | if(rv == 0) { |
|---|
| | 112 | /* Not an error, |
|---|
| | 113 | * but the module didn't take responsibility for the config. |
|---|
| | 114 | */ |
|---|
| | 115 | noit_hash_destroy(config, free, free); |
|---|
| | 116 | free(config); |
|---|
| | 117 | } |
|---|
| | 118 | else if(rv < 0) { |
|---|
| | 119 | noitL(noit_stderr, |
|---|
| | 120 | "Configure failed on %s:%s\n", module_file, module_name); |
|---|
| | 121 | continue; |
|---|
| | 122 | } |
|---|
| 112 | 123 | } |
|---|
| 113 | 124 | if(module->init && module->init(module)) { |
|---|
| … | … | |
| 119 | 130 | module_file, module_name); |
|---|
| 120 | 131 | } |
|---|
| | 132 | free(sections); |
|---|
| 121 | 133 | } |
|---|
| 122 | 134 | |
|---|