]> wimlib.net Git - wimlib/blobdiff - src/win32_apply.c
load_prepopulate_pats(): Fix free
[wimlib] / src / win32_apply.c
index 2b0d5a4bdc221c9b5953d7e8361b13f986a6de26..c182862ea42af8e4483a687df00d665222184216 100644 (file)
@@ -59,14 +59,6 @@ set_prepopulate_pats(struct apply_ctx *ctx, struct string_set *s)
        ctx->private[2] = (intptr_t)s;
 }
 
-static struct string_set *
-alloc_prepopulate_pats(struct apply_ctx *ctx)
-{
-       struct string_set *s = CALLOC(1, sizeof(*s));
-       set_prepopulate_pats(ctx, s);
-       return s;
-}
-
 static struct string_set *
 get_prepopulate_pats(struct apply_ctx *ctx)
 {
@@ -118,7 +110,7 @@ load_prepopulate_pats(struct apply_ctx *ctx)
        if (ret)
                return ret;
 
-       s = alloc_prepopulate_pats(ctx);
+       s = CALLOC(1, sizeof(struct string_set));
        if (!s) {
                FREE(buf);
                return WIMLIB_ERR_NOMEM;
@@ -133,9 +125,10 @@ load_prepopulate_pats(struct apply_ctx *ctx)
                                mangle_pat);
        FREE(buf);
        if (ret) {
-               free_prepopulate_pats(ctx);
+               FREE(s);
                return ret;
        }
+       set_prepopulate_pats(ctx, s);
        ctx->private[3] = (intptr_t)mem;
        return 0;
 }