adji

Adji's a Decisive and Joyful Internet browser
git clone https://noxz.tech/git/adji.git
Log | Files | Tags | LICENSE

commit: b0f2245f36918199503a1c5493abb7de19c8532e
parent: 85fbb9c3ed2364bce83e6860192969f6d359ef27
author: Chris Noxz <chris@noxz.tech>
date:   Tue, 4 Apr 2023 14:42:59 +0200
set all freeable variables to NULL for safety
Mbrowser.c28++++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/browser.c b/browser.c
@@ -341,8 +341,8 @@ ipc_send(char *data)
 void
 ipc_setup(void)
 {
-	gchar                  *f,                  /* fifo file name */
-	                       *p;                  /* fifo file path */
+	gchar                  *f = NULL,           /* fifo file name */
+	                       *p = NULL;           /* fifo file path */
 
 	/* only setup for ipc clients */
 	if (gl.ipc != IPC_CLIENT)
@@ -377,7 +377,7 @@ key_common(struct Client                       *c,
 {
 	int                     i,
 	                        m;
-	gchar                  *u;
+	gchar                  *u = NULL;
 
 	/* only handle key presses using the alt key */
 	if (!(event->state & GDK_MOD1_MASK))
@@ -500,7 +500,7 @@ key_entry(struct Client                        *c,
 {
 	const gchar            *t,
 	                       *l;
-	gchar                  *u;
+	gchar                  *u = NULL;
 	int                     p,
 	                        m;
 
@@ -879,9 +879,9 @@ render_tls_error(struct Client                 *c,
                  GTlsCertificate               *crt,
                  GTlsCertificateFlags           cert_flags)
 {
-	GString                *m;                  /* message (error) */
-	gchar                  *h,                  /* html code */
-	                       *p;                  /* pem block */
+	GString                *m = NULL;           /* message (error) */
+	gchar                  *h = NULL,           /* html code */
+	                       *p = NULL;           /* pem block */
 
 	m                       = g_string_new(NULL);
 	c->failed_crt           = g_object_ref(crt);
@@ -1071,7 +1071,7 @@ selection_search_finished(struct Client        *c,
 void
 set_default_web_context(void)
 {
-	gchar                  *p;                  /* web extensions path */
+	gchar                  *p = NULL;           /* web extensions path */
 	WebKitWebContext       *c;                  /* web context */
 
 	/* no context needed for clients */
@@ -1200,7 +1200,7 @@ resolve_uri(const gchar *t)
 {
 	gchar                  *u = NULL,           /* uri to return */
 	                       *l = NULL;           /* temporary string */
-	const gchar            *s;
+	const gchar            *s = NULL;
 
 	/* check if valid scheme, and if so just create a copy of the text */
 	if ((s = g_uri_peek_scheme(t)) && g_strv_contains(CFG_L(UriSchemes), s))
@@ -1231,9 +1231,9 @@ update_download_button(WebKitDownload          *d,
 {
 	gdouble                 p,                  /* percent completed */
 	                        l;                  /* responce length (bytes) */
-	gchar                  *t,                  /* text holder*/
-	                       *f,                  /* file name */
-	                       *b;                  /* base name */
+	gchar                  *t = NULL,           /* text holder*/
+	                       *f = NULL,           /* file name */
+	                       *b = NULL;           /* base name */
 
 	if ((f = g_filename_from_uri(webkit_download_get_destination(d), NULL, NULL)
 	    ) == NULL)
@@ -1299,7 +1299,7 @@ update_title(struct Client *c)
 {
 	const gchar            *t,
 	                       *u;
-	gchar                  *m;
+	gchar                  *m = NULL;
 
 	u = WV_GET_URI(c->wv);
 	t = webkit_web_view_get_title(WEBKIT_WEB_VIEW(c->wv));
@@ -1348,7 +1348,7 @@ uri_changed(struct Client *c)
 void
 web_view_crashed(struct Client *c)
 {
-	gchar                  *t;
+	gchar                  *t = NULL;
 
 	gtk_entry_set_text(
 	    GTK_ENTRY(c->entry),