diff options
author | John Ankarström <john@ankarstrom.se> | 2021-09-18 10:42:51 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-09-18 10:42:51 +0200 |
commit | b67acafd615ae705a3e3682f87f35027789ddda5 (patch) | |
tree | 0ecead714fee2940e6793da65e67a167d860083e | |
parent | 0292e86cf884a26108a59d81d69cee83b54f4c88 (diff) | |
download | cforum-b67acafd615ae705a3e3682f87f35027789ddda5.tar.gz |
Free database structs after use
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | ctl.c | 3 | ||||
-rw-r--r-- | t/front.t | 3 | ||||
-rw-r--r-- | t/post.t | 3 |
4 files changed, 11 insertions, 6 deletions
@@ -9,7 +9,7 @@ It is also rather small: wc -l *.c *.h */*.t */*.lex 96 cforum.c - 96 ctl.c + 99 ctl.c 133 db.c 10 err.c 106 query.c @@ -20,9 +20,9 @@ It is also rather small: 2 site.h 3 t/err.t 1 t/foot.t - 13 t/front.t + 14 t/front.t 6 t/head.t - 27 t/post.t + 28 t/post.t 2 t/user.t 87 mktpl/mktpl.lex - 636 total + 641 total @@ -31,6 +31,7 @@ showatt(id) printf("Content-Type: %s\n\n", att->mime); printf("%.*s", att->bytes, att->data); + free(att); } void @@ -77,6 +78,8 @@ showpost(int id) title = site.name; printf("Content-Type: text/html\n\n"); #include "t/post.tc" + free(user); + free(post); } void @@ -9,6 +9,7 @@ <td><a href="?user=<% printf("%d", post->user); %>"><%= user->name %></a></td> <td><% printdate(post->created); %></td> </tr> - <% } %> + <% free(post); + } %> </table> <% #include "foot.tc" %>
\ No newline at end of file @@ -22,7 +22,8 @@ <td><%= att->mime %></td> <td><%= att->description %></td> </tr> - <% }while(att = nextatt(stmt)); %> + <% free(att); + }while(att = nextatt(stmt)); %> </table> <% } %> <% #include "foot.tc" %>
\ No newline at end of file |