diff options
author | ken <ken@FreeBSD.org> | 1999-09-12 19:40:20 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 1999-09-12 19:40:20 +0000 |
commit | d9de85e5aa4a1241264ea9f89a866de7149f2b93 (patch) | |
tree | 6ce47ef6836aafbe3f785043e3ca38f8eb49cf2c /lib | |
parent | e40ba941364b555156f97e792df57b178b8d291c (diff) | |
download | FreeBSD-src-d9de85e5aa4a1241264ea9f89a866de7149f2b93.zip FreeBSD-src-d9de85e5aa4a1241264ea9f89a866de7149f2b93.tar.gz |
Fix a file descriptor leak in cam_open_btl(). The xpt device was opened,
but never closed.
Submitted by: amobbs@allstor-sw.co.uk
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcam/camlib.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c index 5f2152d..648b030 100644 --- a/lib/libcam/camlib.c +++ b/lib/libcam/camlib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998 Kenneth D. Merry. + * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -357,6 +357,7 @@ cam_open_btl(path_id_t path_id, target_id_t target_id, lun_id_t target_lun, if (ccb.cdm.matches == NULL) { snprintf(cam_errbuf, CAM_ERRBUF_SIZE, "%s: couldn't malloc match buffer", func_name); + close(fd); return(NULL); } ccb.cdm.num_matches = 0; @@ -370,6 +371,7 @@ cam_open_btl(path_id_t path_id, target_id_t target_id, lun_id_t target_lun, snprintf(cam_errbuf, CAM_ERRBUF_SIZE, "%s: couldn't malloc pattern buffer", func_name); free(ccb.cdm.matches); + close(fd); return(NULL); } ccb.cdm.patterns[0].type = DEV_MATCH_PERIPH; @@ -429,6 +431,7 @@ cam_open_btl(path_id_t path_id, target_id_t target_id, lun_id_t target_lun, pass_unit = periph_result->unit_number; free(ccb.cdm.matches); free(ccb.cdm.patterns); + close(fd); sprintf(dev_path, "/dev/pass%d", pass_unit); return(cam_real_open_device(dev_path, flags, device, NULL, NULL, 0)); @@ -444,6 +447,7 @@ cam_open_btl(path_id_t path_id, target_id_t target_id, lun_id_t target_lun, btl_bailout: free(ccb.cdm.matches); free(ccb.cdm.patterns); + close(fd); return(NULL); } |