Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close a few memory leaks #2216

Merged
merged 5 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18556,9 +18556,13 @@ handle_get_tasks (gmp_parser_t *gmp_parser, GError **error)
auto_delete ? auto_delete : "0",
auto_delete_data ? auto_delete_data : "0");

g_free (assets_apply_overrides);
g_free (assets_min_qod);
g_free (in_assets);
g_free (max_checks);
g_free (max_hosts);
g_free (auto_delete);
g_free (auto_delete_data);
}

count++;
Expand Down
1 change: 1 addition & 0 deletions src/lsc_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ lsc_crypt_release (lsc_crypt_ctx_t ctx)
lsc_crypt_flush (ctx);
if (ctx->encctx) /* Check required for gpgme < 1.3.1 */
gpgme_release (ctx->encctx);
g_free (ctx->enckey_uid);
g_free (ctx);
}

Expand Down
1 change: 1 addition & 0 deletions src/manage_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ acl_where_owned_user (const char *user_id, const char *user_sql,
if (permissions == NULL || permissions->len == 0)
{
/* Treat filters with no permissions keyword as "any". */
g_string_free (permission_or, TRUE);
permission_or = g_string_new ("t ()");
index = 1;
}
Expand Down
6 changes: 5 additions & 1 deletion src/manage_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,11 @@ should_sync_configs ()
&& strlen (config_path) >= (36 /* UUID */ + strlen (".xml"))
&& g_str_has_suffix (config_path, ".xml")
&& should_sync_config_from_path (config_path, FALSE, &config))
return TRUE;
{
g_dir_close (dir);
return TRUE;
}

g_dir_close (dir);
return FALSE;
}
6 changes: 5 additions & 1 deletion src/manage_port_lists.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,11 @@ should_sync_port_lists ()
&& strlen (port_list_path) >= (36 /* UUID */ + strlen (".xml"))
&& g_str_has_suffix (port_list_path, ".xml")
&& should_sync_port_list_from_path (port_list_path, FALSE, &port_list))
return TRUE;
{
g_dir_close (dir);
return TRUE;
}

g_dir_close (dir);
return FALSE;
}
6 changes: 5 additions & 1 deletion src/manage_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,11 @@ should_sync_report_formats ()
&& should_sync_report_format_from_path (report_format_path,
FALSE,
&report_format))
return TRUE;
{
g_dir_close (dir);
return TRUE;
}

g_dir_close (dir);
return FALSE;
}
6 changes: 5 additions & 1 deletion src/manage_sql_nvts.c
Original file line number Diff line number Diff line change
Expand Up @@ -2462,8 +2462,10 @@ nvts_feed_version_status_internal (const gchar *update_socket,

scanner_feed_version = osp_scanner_feed_version (update_socket);
g_debug ("%s: scanner_feed_version: %s", __func__, scanner_feed_version);
if (scanner_feed_version == NULL)
if (scanner_feed_version == NULL) {
g_free (db_feed_version);
return -1;
}
if (scanner_feed_version_out && scanner_feed_version)
*scanner_feed_version_out = g_strdup (scanner_feed_version);

Expand All @@ -2475,6 +2477,8 @@ nvts_feed_version_status_internal (const gchar *update_socket,
return 1;
}

g_free (db_feed_version);
g_free (scanner_feed_version);
return 0;
}

Expand Down
Loading