Skip to content
Snippets Groups Projects
Commit bb012b7c authored by Brian Carrier's avatar Brian Carrier
Browse files

split image names are stored in local copy

parent cd466606
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ applied to deleted directories. ...@@ -18,6 +18,7 @@ applied to deleted directories.
New Features: New Features:
- 3213888: RAW CD format - 3213888: RAW CD format
- Auto class accepts TSK_IMG_INFO as argument - Auto class accepts TSK_IMG_INFO as argument
- Copies of split image file names are stored in TSK so that the caller can free them before TSK_IMG_INFO is freed.
---------------- VERSION 3.2.1 -------------- ---------------- VERSION 3.2.1 --------------
Bug Fixes Bug Fixes
......
...@@ -317,8 +317,16 @@ split_close(TSK_IMG_INFO * img_info) ...@@ -317,8 +317,16 @@ split_close(TSK_IMG_INFO * img_info)
close(split_info->cache[i].fd); close(split_info->cache[i].fd);
#endif #endif
} }
free(split_info->max_off); for(i = 0; i < split_info->num_img; i++){
free(split_info->cptr); if (split_info->images[i])
free(split_info->images[i]);
}
if (split_info->max_off)
free(split_info->max_off);
if (split_info->images)
free(split_info->images);
if (split_info->cptr)
free(split_info->cptr);
free(split_info); free(split_info);
} }
...@@ -376,9 +384,32 @@ split_open(int num_img, const TSK_TCHAR * const images[], ...@@ -376,9 +384,32 @@ split_open(int num_img, const TSK_TCHAR * const images[],
return NULL; return NULL;
} }
img_info->size = 0; img_info->size = 0;
split_info->num_img = num_img; split_info->num_img = num_img;
split_info->images = images;
split_info->images = (TSK_TCHAR **) tsk_malloc(sizeof(TSK_TCHAR *) * num_img);
if(split_info->images == NULL){
free(split_info->max_off);
free(split_info->cptr);
free(split_info);
return NULL;
}
for(i=0; i < num_img; i++){
size_t len = TSTRLEN(images[i]);
split_info->images[i] = (TSK_TCHAR *) tsk_malloc(sizeof(TSK_TCHAR) * (len+1));
if(split_info->images == NULL){
while(i > 0){
i--;
free(split_info->images[i]);
}
free(split_info->images);
free(split_info->max_off);
free(split_info->cptr);
free(split_info);
return NULL;
}
TSTRNCPY(split_info->images[i], images[i], len);
}
/* Get size info for each file - we do not open each one because that /* Get size info for each file - we do not open each one because that
* could cause us to run out of file decsriptors when we only need a few. * could cause us to run out of file decsriptors when we only need a few.
......
...@@ -38,7 +38,7 @@ extern "C" { ...@@ -38,7 +38,7 @@ extern "C" {
int num_img; int num_img;
// the following are protected by cache_lock in IMG_INFO // the following are protected by cache_lock in IMG_INFO
const TSK_TCHAR *const *images; TSK_TCHAR **images;
TSK_OFF_T *max_off; TSK_OFF_T *max_off;
int *cptr; /* exists for each image - points to entry in cache */ int *cptr; /* exists for each image - points to entry in cache */
IMG_SPLIT_CACHE cache[SPLIT_CACHE]; /* small number of fds for open images */ IMG_SPLIT_CACHE cache[SPLIT_CACHE]; /* small number of fds for open images */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment