git-svn: trunk@4403
aCaB authored on 2008/11/14 01:54:22... | ... |
@@ -3450,16 +3450,18 @@ clamfi_eom(SMFICTX *ctx) |
3450 | 3450 |
if(!external) { |
3451 | 3451 |
const char *virname; |
3452 | 3452 |
int ret; |
3453 |
+ struct cl_engine *cur_engine; |
|
3453 | 3454 |
|
3454 | 3455 |
pthread_mutex_lock(&engine_mutex); |
3455 | 3456 |
ret = cl_engine_addref(engine); |
3457 |
+ cur_engine = engine; /* avoid races */ |
|
3456 | 3458 |
pthread_mutex_unlock(&engine_mutex); |
3457 | 3459 |
if(ret != CL_SUCCESS) { |
3458 | 3460 |
logg("!cl_engine_addref failed\n"); |
3459 | 3461 |
clamfi_cleanup(ctx); |
3460 | 3462 |
return cl_error; |
3461 | 3463 |
} |
3462 |
- switch(cl_scanfile(privdata->filename, &virname, NULL, engine, options)) { |
|
3464 |
+ switch(cl_scanfile(privdata->filename, &virname, NULL, cur_engine, options)) { |
|
3463 | 3465 |
case CL_CLEAN: |
3464 | 3466 |
if(logok) |
3465 | 3467 |
logg("#%s: OK\n", privdata->filename); |
... | ... |
@@ -3474,7 +3476,7 @@ clamfi_eom(SMFICTX *ctx) |
3474 | 3474 |
logg("!%s\n", mess); |
3475 | 3475 |
break; |
3476 | 3476 |
} |
3477 |
- cl_engine_free(engine); /* drop reference or free */ |
|
3477 |
+ cl_engine_free(cur_engine); /* drop reference or free */ |
|
3478 | 3478 |
|
3479 | 3479 |
#ifdef SESSION |
3480 | 3480 |
session = NULL; |