|
From: wasted <wa...@fi...> - 2003-12-22 08:53:38
|
wasted 2003/12/22 02:54:21 CST
Modified files:
src gline.c mysql.c
Log:
Fix 2 bugs that caused a nasty core.
Revision Changes Path
1.2 +14 -13 wStats/src/gline.c
1.2 +2 -2 wStats/src/mysql.c
Index: gline.c
===================================================================
RCS file: /home/cvs/wstats/wStats/src/gline.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gline.c 13 Dec 2003 13:36:22 -0000 1.1
+++ gline.c 22 Dec 2003 08:54:21 -0000 1.2
@@ -18,7 +18,7 @@
* wStats is derrived from srvx (http://srvx.net), everything in here that's
* original srvx code, Copyrighted 2000-2003 srvx Development Team.
*
- * $Id: gline.c,v 1.1 2003/12/13 13:36:22 wasted Exp $
+ * $Id: gline.c,v 1.2 2003/12/22 08:54:21 wasted Exp $
*/
#include "heap.h"
@@ -40,6 +40,18 @@
free(ent);
}
+static void
+expire_gline(void *data)
+{
+ struct gline *ex_gline = data;
+
+ if(dict_find(gline_dict, ex_gline->target, NULL))
+ {
+ dict_remove(gline_dict, ex_gline->target);
+ free(ex_gline);
+ }
+}
+
int
gline_remove(const char *target)
{
@@ -48,23 +60,12 @@
if((ex_gline = dict_find(gline_dict, target, NULL)))
{
dict_remove(gline_dict, target);
+ timeq_del(0, expire_gline, ex_gline, TIMEQ_IGNORE_WHEN);
free(ex_gline);
return 1;
}
return 0;
-}
-
-static void
-expire_gline(void *data)
-{
- struct gline *ex_gline = data;
-
- if(dict_find(gline_dict, ex_gline->target, NULL))
- {
- dict_remove(gline_dict, ex_gline->target);
- free(ex_gline);
- }
}
struct gline *
Index: mysql.c
===================================================================
RCS file: /home/cvs/wstats/wStats/src/mysql.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mysql.c 13 Dec 2003 13:36:24 -0000 1.1
+++ mysql.c 22 Dec 2003 08:54:21 -0000 1.2
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: mysql.c,v 1.1 2003/12/13 13:36:24 wasted Exp $
+ * $Id: mysql.c,v 1.2 2003/12/22 08:54:21 wasted Exp $
*/
#include <mysql/mysql.h>
@@ -154,7 +154,7 @@
if(str)
{
out = malloc((strlen(str) * 2) + 1);
- mysql_real_escape_string(&mysql, out, str, strlen(str));
+ mysql_real_escape_string(&mysql, out, strdup(str), strlen(str));
return out;
}
return str;
|