Skip to content

Commit

Permalink
Merge pull request #2327 from greenbone/fix-create-credential-privkey…
Browse files Browse the repository at this point in the history
…-error

Fix: Rollback on create_credential privkey error
  • Loading branch information
mattmundell authored Dec 2, 2024
2 parents 2d79e64 + e2ca261 commit 71f7362
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -35785,6 +35785,7 @@ create_credential (const char* name, const char* comment, const char* login,
else
{
g_warning ("%s: Cannot determine type of new credential", __func__);
sql_rollback ();
return 18;
}

Expand Down Expand Up @@ -35952,7 +35953,10 @@ create_credential (const char* name, const char* comment, const char* login,
if (key_private)
key_private_truncated = truncate_private_key (key_private);
else
return 3;
{
sql_rollback ();
return 3;
}

generated_key_public = gvm_ssh_public_from_private
(key_private_truncated
Expand All @@ -35962,6 +35966,7 @@ create_credential (const char* name, const char* comment, const char* login,
if (generated_key_public == NULL)
{
g_free (key_private_truncated);
sql_rollback ();
return 3;
}
g_free (generated_key_public);
Expand Down

0 comments on commit 71f7362

Please sign in to comment.