X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fwim.c;h=bd31c5b3ea9d1e1f1ee9e6ef262e502586988a5c;hb=ad37dd86e75416ffc47c97b35f097012be5eeaa2;hp=e1698952e0f5c889ca9ff8bbb6449a223ad5d536;hpb=2e698d082750987ba1734beb8b1934efec1d9856;p=wimlib diff --git a/src/wim.c b/src/wim.c index e1698952..bd31c5b3 100644 --- a/src/wim.c +++ b/src/wim.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2012 Eric Biggers + * Copyright (C) 2012, 2013 Eric Biggers * * wimlib - Library for working with WIM files * @@ -233,10 +233,9 @@ int select_wim_image(WIMStruct *w, int image) imd->security_data = NULL; INIT_HLIST_HEAD(&imd->inode_list); } - w->current_image = WIMLIB_NO_IMAGE; } - - imd = wim_get_current_image_metadata(w); + w->current_image = image; + imd = &w->image_metadata[image - 1]; if (imd->root_dentry) { ret = 0; } else { @@ -246,9 +245,9 @@ int select_wim_image(WIMStruct *w, int image) print_lookup_table_entry(imd->metadata_lte, stdout); #endif ret = read_metadata_resource(w, imd); + if (ret) + w->current_image = WIMLIB_NO_IMAGE; } - if (ret == 0) - w->current_image = image; return ret; } @@ -600,7 +599,7 @@ void destroy_image_metadata(struct wim_image_metadata *imd, * closes all files associated with the WIMStruct. */ WIMLIBAPI void wimlib_free(WIMStruct *w) { - DEBUG2("Freeing WIMStruct"); + DEBUG("Freeing WIMStruct"); if (!w) return; @@ -636,6 +635,7 @@ WIMLIBAPI void wimlib_free(WIMStruct *w) } #endif FREE(w); + DEBUG("Freed WIMStruct"); } /* Get global memory allocations out of the way. Not strictly necessary in