Skip to content

Commit

Permalink
Call fclose() once
Browse files Browse the repository at this point in the history
  • Loading branch information
asn-d6 committed Mar 4, 2024
1 parent 4fa86d9 commit 40f6376
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bindings/python/ckzg.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ static PyObject* load_trusted_setup_wrap(PyObject *self, PyObject *args) {
return PyErr_Format(PyExc_RuntimeError, "error reading trusted setup");
}

if (load_trusted_setup_file(s, fp) != C_KZG_OK) {
C_KZG_RET ret = load_trusted_setup_file(s, fp);
fclose(fp);

if (ret != C_KZG_OK) {
free(s);
fclose(fp);
return PyErr_Format(PyExc_RuntimeError, "error loading trusted setup");
}

fclose(fp);
return PyCapsule_New(s, "KZGSettings", free_KZGSettings);
}

Expand Down

0 comments on commit 40f6376

Please sign in to comment.