Skip to content
Permalink
Browse files

Bug fix---double free

Memory managament is a bitch if you aren't careful about object lifetimes.
cmd_cgi_post_show() was calling BlogEntryFree(), but the entry in question
had already been freed in cb_entry() as part of displaying the page.  I
think this was the last bit of code at this level that actually freed
entries (all others at this level have been removed).

This is what happens in seldom used code---bug accumlate in the dark corners
and fester like this until an emergency happens and BOOM!  You end up not
being able to post to the blog during a power outtage.
  • Loading branch information...
spc476 committed Jun 6, 2015
1 parent 64e2680 commit 3e0662eea842754d8ec9bc922112670f23091384
Showing with 0 additions and 1 deletion.
  1. +0 −1 src/cgi_main.c
@@ -411,7 +411,6 @@ static int cmd_cgi_post_show(Request req)
fputs("Status: 200\r\nContent-type: text/html\r\n\r\n",req->out);
generic_cb("main",req->out,&cbd);

BlogEntryFree(entry);
return(0);
}

0 comments on commit 3e0662e

Please sign in to comment.
You can’t perform that action at this time.