No frees on return, so this does look like a memory leak. What's sizeof(*tm), shouldn't it be sizeof(struct tm)? Wait, why is there am allocation here at all? It looks like the pointer to the allocated memory is overwritten ("tm = gmtime(&t)") and the allocated memory is never referenced.. Also, should use thread-safe gtime_r (http://www.opengroup.org/onlinepubs/009695399/functions/gmtime.html).
Here's a quick, first cut using a basic tool, cppcheck. Also see the item at the bottom which is from compiler warnings.
No frees on return, so this does look like a memory leak. What's sizeof(*tm), shouldn't it be sizeof(struct tm)? Wait, why is there am allocation here at all? It looks like the pointer to the allocated memory is overwritten ("tm = gmtime(&t)") and the allocated memory is never referenced.. Also, should use thread-safe gtime_r (http:// www.opengroup. org/onlinepubs/ 009695399/ functions/ gmtime. html).
if (!dconf->need_dbtc) {
dbtc_ log("dbtc( ): no need dbtc");
return DECLINED;
};
if (r->main != NULL) /*no subrequests*/
dbtc_ log("dbtc( ): not a main request");
return DECLINED;
tstr = apr_psprintf( r->pool, "%d", t);
{
}
tm = gmtime(&t);
t = mktime(tm);
int test_hook( request_ rec *r) {
struct_ test_dir_ config *dconf;
char body[MAX_BODY];
const char *result;
// const char *body = "here is line\r\nhere IS digits: 12345\r\nqqqq\n";
if (!dconf->enable) {
jsf_log( "test_hook( ): don't need test");
return DECLINED;
};
if (!(f = fopen(" /var/tmp/ test.js" , "r"))) {
jsf_err_ log("test_ hook(): Can't open a file");
return OK;
}
if (!regs_v) jsf_err_
/*
while (!feof(f)) {
result = jsf(r, regs_v, body, strlen(body));
result = body;
if (fgets(body, MAX_BODY, f)) {
if (regs_v) {
} else {
}
}
}
*/
}
tm = gmtime(&t);
tstr = apr_psprintf( r->pool, "%d", (int)t);
t = mktime(tm);
if (!(dbd = ap_dbd_acquire(r))) {
ctdb_ err_log( "ctdb() : Can't get DB connect");
return;
===== ======= ======= ======= ======= ======= ======= ======= =
}
{
if (ap_is_
{
}
{
}
}