Mercurial > urweb
comparison src/cjr_print.sml @ 425:7009b0ac1501
Properly freeing libpq results on errors
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Fri, 24 Oct 2008 17:30:07 -0400 |
parents | b10132434adc |
children | 5de838fb0950 |
comparison
equal
deleted
inserted
replaced
424:b10132434adc | 425:7009b0ac1501 |
---|---|
848 newline, | 848 newline, |
849 newline, | 849 newline, |
850 | 850 |
851 string "uw_end_region(ctx);", | 851 string "uw_end_region(ctx);", |
852 newline, | 852 newline, |
853 string "uw_push_cleanup(ctx, (void (*)(void *))PQclear, res);", | |
854 newline, | |
853 string "n = PQntuples(res);", | 855 string "n = PQntuples(res);", |
854 newline, | 856 newline, |
855 string "for (i = 0; i < n; ++i) {", | 857 string "for (i = 0; i < n; ++i) {", |
856 newline, | 858 newline, |
857 box [string "struct", | 859 box [string "struct", |
904 string ";", | 906 string ";", |
905 newline], | 907 newline], |
906 string "}", | 908 string "}", |
907 newline, | 909 newline, |
908 newline, | 910 newline, |
909 string "PQclear(res);", | 911 string "uw_pop_cleanup(ctx);", |
910 newline, | 912 newline, |
911 if wontLeakAnything then | 913 if wontLeakAnything then |
912 box [string "uw_end_region(ctx);", | 914 box [string "uw_end_region(ctx);", |
913 newline] | 915 newline] |
914 else | 916 else |