fix off by 1 error
[rrdtool.git] / bindings / lua / rrdlua.c
index a5b9fb7..690ba29 100644 (file)
@@ -66,7 +66,7 @@ static char **make_argv(const char *cmd, lua_State * L)
   for (i=1; i<argc; i++) {
     /* accepts string or number */
     if (lua_isstring(L, i) || lua_isnumber(L, i)) {
-      if (!(argv[i] = strdup(lua_tostring (L, i)))) {
+      if (!(argv[i] = lua_tostring (L, i))) {
         /* raise an error and never return */
         luaL_error(L, "%s - error duplicating string area for arg #%d",
                    cmd, i);
@@ -292,6 +292,12 @@ lua_rrd_graph (lua_State * L)
   return 3;
 }
 
+static int
+lua_rrd_flushcached(lua_State *L)
+{
+  return rrd_common_call(L, "flushcached", rrd_flushcached);
+}
+
 #if defined(DINF)
 static int
 lua_rrd_info (lua_State * L)
@@ -347,6 +353,7 @@ static const struct luaL_reg rrd[] = {
   {"restore", lua_rrd_restore},
   {"tune", lua_rrd_tune},
   {"update", lua_rrd_update},
+  {"flushcached", lua_rrd_flushcached},
 #if defined(DINF)
   {"info", lua_rrd_info},
   {"updatev", lua_rrd_updatev},