fix use after free

This commit is contained in:
Love Hornquist Astrand
2012-11-27 21:05:45 -08:00
parent 6294c36526
commit 353ac10863

View File

@@ -839,7 +839,6 @@ p11_init(hx509_context context,
} }
p->dl_handle = dlopen(list, RTLD_NOW); p->dl_handle = dlopen(list, RTLD_NOW);
free(list);
if (p->dl_handle == NULL) { if (p->dl_handle == NULL) {
ret = HX509_PKCS11_LOAD; ret = HX509_PKCS11_LOAD;
hx509_set_error_string(context, 0, ret, hx509_set_error_string(context, 0, ret,
@@ -935,10 +934,14 @@ p11_init(hx509_context context,
} }
} }
free(list);
*data = p; *data = p;
return 0; return 0;
out: out:
if (list)
free(list);
p11_release_module(p); p11_release_module(p);
return ret; return ret;
} }