Set TLS key to NULL after scan is done (bb #2353).

0.96
Török Edvin 15 years ago
parent 5d040c88d4
commit 0d79b7dc17
  1. 1
      libclamav/others.h
  2. 5
      libclamav/others_common.c
  3. 3
      libclamav/scanners.c

@ -436,6 +436,7 @@ void cli_infomsg(const cli_ctx* ctx, const char *fmt, ...);
#endif
void cli_logg_setup(const cli_ctx* ctx);
void cli_logg_unsetup(void);
/* tell compiler about branches that are very rarely taken,
* such as debug paths, and error paths */

@ -89,6 +89,11 @@ void cli_logg_setup(const cli_ctx *ctx)
pthread_setspecific(cli_ctx_tls_key, ctx);
}
void cli_logg_unsetup(void)
{
pthread_setspecific(cli_ctx_tls_key, NULL);
}
static inline void *cli_getctx(void)
{
cli_ctx *ctx = pthread_getspecific(cli_ctx_tls_key);

@ -2444,7 +2444,8 @@ int cl_scandesc_callback(int desc, const char **virname, unsigned long int *scan
cli_bitset_free(ctx.hook_lsig_matches);
free(ctx.fmap);
if(rc == CL_CLEAN && ctx.found_possibly_unwanted)
rc = CL_VIRUS;
rc = CL_VIRUS;
cli_logg_unsetup(&ctx);
return rc;
}

Loading…
Cancel
Save