Commit 9adfa99
committed
fix(jni): free QueryResult on Arrow entry-point failure
The four Arrow JNI entry points (createArrowTable, createArrowRelTable,
createArrowRelTableCSR, dropArrowTable) freed only their wrapper on
failure. The C API's setQueryResult (ladybug/src/c_api/connection.cpp:77)
releases the C++ QueryResult into the out-param *before* checking success,
so on the setQueryResult failure branch the out-param owned a QueryResult
that the wrapper's delete did not touch and lbug_query_result_destroy
was not called.
Linear leak of ~432 bytes per failed call, verified by RSS measurement in
issue #13.
Call lbug_query_result_destroy(queryResult) before delete on the failure
branch of all four. lbug_query_result_destroy is null-safe and a no-op
when setQueryResult did not run, so this is safe for both the
setQueryResult and the catch-block failure modes.
Closes #131 parent 0111e0a commit 9adfa99
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
856 | 860 | | |
857 | 861 | | |
858 | 862 | | |
| |||
880 | 884 | | |
881 | 885 | | |
882 | 886 | | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
883 | 891 | | |
884 | 892 | | |
885 | 893 | | |
| |||
919 | 927 | | |
920 | 928 | | |
921 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
922 | 934 | | |
923 | 935 | | |
924 | 936 | | |
| |||
940 | 952 | | |
941 | 953 | | |
942 | 954 | | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
943 | 959 | | |
944 | 960 | | |
945 | 961 | | |
| |||
0 commit comments