X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fsecurity.c;h=bc44b45ae9d3707dea3fe6fb670e47d5c3d326f6;hb=7c08b0b067f48e80226e6b5466fd95feb43139e6;hp=9707bd313359383f4b8a6c9bd4f81e0fe11eedeb;hpb=6f7956a06fcf92a304fae93e393e8eaee34e92d5;p=wimlib diff --git a/src/security.c b/src/security.c index 9707bd31..bc44b45a 100644 --- a/src/security.c +++ b/src/security.c @@ -28,8 +28,6 @@ #include "io.h" #include "security.h" -#ifdef ENABLE_SECURITY_DATA - /* * Reads the security data from the metadata resource. * @@ -127,6 +125,8 @@ int read_security_data(const u8 metadata_resource[], u64 metadata_resource_len, "(current total length = %"PRIu64", security " "descriptor size = %"PRIu64")", total_len, sd->sizes[i]); + ret = WIMLIB_ERR_INVALID_SECURITY_DATA; + goto out_free_sd; } total_len += sd->sizes[i]; if (total_len > (u64)sd->total_length) { @@ -267,8 +267,8 @@ void free_security_data(struct wim_security_data *sd) { if (!sd) return; - wimlib_assert(sd->refcnt >= 1); - if (sd->refcnt == 1) { + wimlib_assert(sd->refcnt != 0); + if (--sd->refcnt == 0) { u8 **descriptors = sd->descriptors; u32 num_entries = sd->num_entries; if (descriptors) @@ -277,9 +277,5 @@ void free_security_data(struct wim_security_data *sd) FREE(sd->sizes); FREE(sd->descriptors); FREE(sd); - } else { - sd->refcnt--; } } - -#endif