Skip to content

Commit

Permalink
Merge pull request #2216 from greenbone/leaks
Browse files Browse the repository at this point in the history
Close a few memory leaks
  • Loading branch information
a-h-abdelsalam authored Jun 12, 2024
2 parents 274e326 + f71bba7 commit 68fb3fd
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 4 deletions.
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

0 comments on commit 68fb3fd

Please sign in to comment.