[epiphany] Fix issues found through static code analysis
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Fix issues found through static code analysis
- Date: Sat, 15 Dec 2018 20:55:09 +0000 (UTC)
commit 64a3330ced0ac6fe34b57d09a525e31cb30c350e
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sat Dec 15 19:38:22 2018 +0100
Fix issues found through static code analysis
embed/web-extension/ephy-web-extension.c | 2 +-
lib/ephy-snapshot-service.c | 5 ++++-
lib/ephy-web-app-utils.c | 2 +-
lib/history/ephy-history-service-hosts-table.c | 2 +-
lib/history/ephy-history-service-urls-table.c | 2 +-
src/ephy-session.c | 6 +++---
6 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 4e11b600f..b49559309 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -502,7 +502,7 @@ handle_method_call (GDBusConnection *connection,
g_autoptr(JSCValue) password_manager = get_password_manager (extension);
ret = jsc_value_object_invoke_method (password_manager, "_onQueryUsernamesResponse",
G_TYPE_STRV, users, G_TYPE_INT, id, G_TYPE_NONE);
- } else if(g_strcmp0 (method_name, "PasswordQueryResponse") == 0) {
+ } else if (g_strcmp0 (method_name, "PasswordQueryResponse") == 0) {
const char *username;
const char *password;
gint32 id;
diff --git a/lib/ephy-snapshot-service.c b/lib/ephy-snapshot-service.c
index 929b41a92..06163c4fe 100644
--- a/lib/ephy-snapshot-service.c
+++ b/lib/ephy-snapshot-service.c
@@ -203,7 +203,10 @@ save_thumbnail (GdkPixbuf *pixbuf,
g_warning ("Failed to create thumbnail %s: %s", tmp_path, error->message);
g_error_free (error);
}
- unlink (tmp_path);
+
+ if (tmp_path != NULL)
+ unlink (tmp_path);
+
g_free (path);
g_free (tmp_path);
g_free (dirname);
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 5352bed0f..5c9402efd 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -726,7 +726,7 @@ ephy_web_application_save (EphyWebApplication *app)
g_free (name);
icon = g_key_file_get_string (key, "Desktop Entry", "Icon", NULL);
- if (g_strcmp0 (name, app->icon_url) != 0) {
+ if (g_strcmp0 (icon, app->icon_url) != 0) {
changed = TRUE;
g_key_file_set_string (key, "Desktop Entry", "Icon", app->icon_url);
}
diff --git a/lib/history/ephy-history-service-hosts-table.c b/lib/history/ephy-history-service-hosts-table.c
index 2c911dc1e..5b2edfab1 100644
--- a/lib/history/ephy-history-service-hosts-table.c
+++ b/lib/history/ephy-history-service-hosts-table.c
@@ -138,7 +138,7 @@ ephy_history_service_get_host_row (EphyHistoryService *self, const gchar *host_s
if (host_string == NULL && host != NULL)
host_string = host->url;
- g_assert (host_string || host->id != -1);
+ g_assert (host_string || (host != NULL && host->id != -1));
if (host != NULL && host->id != -1) {
statement = ephy_sqlite_connection_create_statement (self->history_database,
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index a8aeb7030..cb5cd2d38 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -64,7 +64,7 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
if (url_string == NULL && url != NULL)
url_string = url->url;
- g_assert (url_string || url->id != -1);
+ g_assert (url_string || (url != NULL && url->id != -1));
if (url != NULL && url->id != -1) {
statement = ephy_sqlite_connection_create_statement (self->history_database,
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 3c35139e5..4b908c0de 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -731,9 +731,9 @@ write_tab (xmlTextWriterPtr writer,
data = g_bytes_get_data (bytes, &data_length);
base64 = g_base64_encode (data, data_length);
- ret = xmlTextWriterWriteAttribute (writer,
- (const xmlChar *)"history",
- (const xmlChar *)base64);
+ xmlTextWriterWriteAttribute (writer,
+ (const xmlChar *)"history",
+ (const xmlChar *)base64);
g_free (base64);
g_bytes_unref (bytes);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]