Skip to content

Commit

Permalink
Use result of g_string_free when arg 2 is FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell authored and timopollmeier committed Oct 5, 2023
1 parent 215c313 commit 0cac973
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions src/lsc_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,8 @@ lsc_crypt_encrypt_hashtable (lsc_crypt_ctx_t ctx, GHashTable *data)
}
}

plaintext = stringbuf->str;
plaintextlen = stringbuf->len;
g_string_free (stringbuf, FALSE);
plaintext = g_string_free (stringbuf, FALSE);
g_assert (plaintextlen);

ciphertext = do_encrypt (ctx, plaintext, plaintextlen);
Expand Down Expand Up @@ -751,9 +750,8 @@ lsc_crypt_encrypt (lsc_crypt_ctx_t ctx, const char *first_name, ...)
while ((name = va_arg (arg_ptr, const char *)))
;
va_end (arg_ptr);
plaintext = stringbuf->str;
plaintextlen = stringbuf->len;
g_string_free (stringbuf, FALSE);
plaintext = g_string_free (stringbuf, FALSE);
g_assert (plaintextlen);

ciphertext = do_encrypt (ctx, plaintext, plaintextlen);
Expand Down
9 changes: 3 additions & 6 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@ get_certificate_info (const gchar* certificate, gssize certificate_len,
g_string_append_printf (string, "%02x", buffer[i]);
}

*md5_fingerprint = string->str;
g_string_free (string, FALSE);
*md5_fingerprint = g_string_free (string, FALSE);
}

if (sha256_fingerprint)
Expand All @@ -497,8 +496,7 @@ get_certificate_info (const gchar* certificate, gssize certificate_len,
g_string_append_printf (string, "%02X", buffer[i]);
}

*sha256_fingerprint = string->str;
g_string_free (string, FALSE);
*sha256_fingerprint = g_string_free (string, FALSE);
}

if (subject)
Expand Down Expand Up @@ -541,8 +539,7 @@ get_certificate_info (const gchar* certificate, gssize certificate_len,
g_string_append_printf (string, "%02X", buffer[i]);
}

*serial = string->str;
g_string_free (string, FALSE);
*serial = g_string_free (string, FALSE);
}

gnutls_x509_crt_deinit (gnutls_cert);
Expand Down
3 changes: 1 addition & 2 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -2140,8 +2140,7 @@ manage_report_filter_controls (const gchar *filter, int *first, int *max,
}
point++;
}
*search_phrase = g_strchomp (phrase->str);
g_string_free (phrase, FALSE);
*search_phrase = g_strchomp (g_string_free (phrase, FALSE));
}

if (result_hosts_only)
Expand Down

0 comments on commit 0cac973

Please sign in to comment.