[Openvas-commits] r5441 - in trunk/openvas-manager: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Oct 8 14:21:17 CEST 2009
Author: mattm
Date: 2009-10-08 14:21:16 +0200 (Thu, 08 Oct 2009)
New Revision: 5441
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/tasks_sql.h
Log:
* src/tasks_sql.h (set_task_parameter): Free rc on fail. Moving setting
the task description and targets to precede filling the config, as
insert_rc_into_config modifies its rc argument.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2009-10-08 10:26:01 UTC (rev 5440)
+++ trunk/openvas-manager/ChangeLog 2009-10-08 12:21:16 UTC (rev 5441)
@@ -1,3 +1,9 @@
+2009-10-08 Matthew Mundell <matthew.mundell at intevation.de>
+
+ * src/tasks_sql.h (set_task_parameter): Free rc on fail. Moving setting
+ the task description and targets to precede filling the config, as
+ insert_rc_into_config modifies its rc argument.
+
2009-10-07 Matthew Mundell <matthew.mundell at intevation.de>
* src/tasks_sql.h (make_task_rcfile): Remove append of name.
Modified: trunk/openvas-manager/src/tasks_sql.h
===================================================================
--- trunk/openvas-manager/src/tasks_sql.h 2009-10-08 10:26:01 UTC (rev 5440)
+++ trunk/openvas-manager/src/tasks_sql.h 2009-10-08 12:21:16 UTC (rev 5441)
@@ -2766,6 +2766,8 @@
int
set_task_parameter (task_t task, const char* parameter, /*@only@*/ char* value)
{
+ /** @todo Free value consistently. */
+
tracef (" set_task_parameter %u %s\n",
task_id (task),
parameter ? parameter : "(null)");
@@ -2785,6 +2787,14 @@
sql ("BEGIN IMMEDIATE;");
+ /* Update task description (rcfile). */
+
+ quoted_rc = sql_quote ((gchar*) rc);
+ sql ("UPDATE tasks SET description = '%s' WHERE ROWID = %llu;",
+ quoted_rc,
+ task);
+ g_free (quoted_rc);
+
/* Update task config. */
{
@@ -2795,6 +2805,7 @@
config_name = task_config (task);
if (config_name == NULL)
{
+ g_free (rc);
sql ("END");
return -1;
}
@@ -2803,6 +2814,7 @@
if (target == NULL)
{
free (config_name);
+ g_free (rc);
sql ("END");
return -1;
}
@@ -2812,6 +2824,7 @@
{
free (config_name);
free (target);
+ g_free (rc);
sql ("END");
return -1;
}
@@ -2823,6 +2836,7 @@
free (quoted_selector);
free (config_name);
free (target);
+ g_free (rc);
sql ("END");
return -1;
}
@@ -2831,6 +2845,7 @@
free (quoted_selector);
free (config_name);
free (target);
+ g_free (rc);
sql ("END");
return -1;
}
@@ -2849,39 +2864,35 @@
quoted_selector);
free (quoted_selector);
- /* Fill config from RC. */
+ /* Replace targets. */
- quoted_config_name = sql_quote (config_name);
- free (config_name);
- if (insert_rc_into_config (config, quoted_config_name, (gchar*) rc))
+ hosts = rc_preference ((gchar*) rc, "targets");
+ if (hosts == NULL)
{
+ free (config_name);
+ g_free (rc);
sql ("END");
return -1;
}
+ set_target_hosts (target, hosts);
+ free (hosts);
- /* Replace targets. */
+ /* Fill config from RC. */
- hosts = rc_preference ((gchar*) rc, "targets");
- if (hosts == NULL)
+ quoted_config_name = sql_quote (config_name);
+ free (config_name);
+ /* This modifies rc. */
+ if (insert_rc_into_config (config, quoted_config_name, (gchar*) rc))
{
+ g_free (rc);
sql ("END");
return -1;
}
- set_target_hosts (target, hosts);
- free (hosts);
+ g_free (rc);
}
+
+ sql ("COMMIT");
}
-
- /* Update task description (rcfile). */
-
- quoted_rc = sql_quote ((gchar*) rc);
- g_free (rc);
- sql ("UPDATE tasks SET description = '%s' WHERE ROWID = %llu;",
- quoted_rc,
- task);
- g_free (quoted_rc);
-
- sql ("COMMIT");
}
else if (strcasecmp ("NAME", parameter) == 0)
{
More information about the Openvas-commits
mailing list