Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd CID 1107545, 1107546: fix memory leak



details:   https://anonhg.NetBSD.org/src/rev/38154a5d7338
branches:  trunk
changeset: 791339:38154a5d7338
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 13 21:46:22 2013 +0000

description:
CID 1107545, 1107546: fix memory leak

diffstat:

 libexec/httpd/lua-bozo.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r d190c23ddd87 -r 38154a5d7338 libexec/httpd/lua-bozo.c
--- a/libexec/httpd/lua-bozo.c  Wed Nov 13 21:44:29 2013 +0000
+++ b/libexec/httpd/lua-bozo.c  Wed Nov 13 21:46:22 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lua-bozo.c,v 1.6 2013/11/13 21:44:29 christos Exp $    */
+/*     $NetBSD: lua-bozo.c,v 1.7 2013/11/13 21:46:22 christos Exp $    */
 
 /*
  * Copyright (c) 2013 Marc Balmer <marc%msys.ch@localhost>
@@ -303,6 +303,7 @@
        char *s, *query, *uri, *file, *command, *info, *content;
        const char *type, *clen;
        char *prefix, *handler, *p;
+       int rv = 0;
 
        if (!httpd->process_lua)
                return 0;
@@ -435,18 +436,18 @@
                                printf("<br>Lua error: %s\n",
                                    lua_tostring(map->L, -1));
                        bozo_flush(httpd, stdout);
-                       free(prefix);
-                       free(uri);
-                       free(info);
-                       free(query);
-                       return 1;
+                       rv = 1;
+                       goto out;
                }
        }
+out:
        free(prefix);
        free(uri);
        free(info);
        free(query);
-       return 0;
+       free(command);
+       free(file);
+       return rv;
 }
 
 #endif /* NO_LUA_SUPPORT */



Home | Main Index | Thread Index | Old Index