... | ... |
@@ -436,6 +436,7 @@ void cli_infomsg(const cli_ctx* ctx, const char *fmt, ...); |
436 | 436 |
#endif |
437 | 437 |
|
438 | 438 |
void cli_logg_setup(const cli_ctx* ctx); |
439 |
+void cli_logg_unsetup(void); |
|
439 | 440 |
|
440 | 441 |
/* tell compiler about branches that are very rarely taken, |
441 | 442 |
* such as debug paths, and error paths */ |
... | ... |
@@ -89,6 +89,11 @@ void cli_logg_setup(const cli_ctx *ctx) |
89 | 89 |
pthread_setspecific(cli_ctx_tls_key, ctx); |
90 | 90 |
} |
91 | 91 |
|
92 |
+void cli_logg_unsetup(void) |
|
93 |
+{ |
|
94 |
+ pthread_setspecific(cli_ctx_tls_key, NULL); |
|
95 |
+} |
|
96 |
+ |
|
92 | 97 |
static inline void *cli_getctx(void) |
93 | 98 |
{ |
94 | 99 |
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 |
2444 | 2444 |
cli_bitset_free(ctx.hook_lsig_matches); |
2445 | 2445 |
free(ctx.fmap); |
2446 | 2446 |
if(rc == CL_CLEAN && ctx.found_possibly_unwanted) |
2447 |
- rc = CL_VIRUS; |
|
2447 |
+ rc = CL_VIRUS; |
|
2448 |
+ cli_logg_unsetup(&ctx); |
|
2448 | 2449 |
return rc; |
2449 | 2450 |
} |
2450 | 2451 |
|