X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fsecurity.c;h=b7b333e246a07f3045384c07ac8e2ada3a12477e;hb=0fee00b52e5f5eeb140695276afe421a7f4d12a7;hp=9707bd313359383f4b8a6c9bd4f81e0fe11eedeb;hpb=6f7956a06fcf92a304fae93e393e8eaee34e92d5;p=wimlib diff --git a/src/security.c b/src/security.c index 9707bd31..b7b333e2 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) { @@ -268,7 +268,7 @@ void free_security_data(struct wim_security_data *sd) if (!sd) return; wimlib_assert(sd->refcnt >= 1); - if (sd->refcnt == 1) { + 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