Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions content/content.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,20 +976,12 @@ content__free_rfc5988_link(struct content_rfc5988_link *link)

next = link->next;

lwc_string_unref(link->rel);
nsurl_unref(link->href);
if (link->hreflang != NULL) {
lwc_string_unref(link->hreflang);
}
if (link->type != NULL) {
lwc_string_unref(link->type);
}
if (link->media != NULL) {
lwc_string_unref(link->media);
}
if (link->sizes != NULL) {
lwc_string_unref(link->sizes);
}
lwc_string_unref(link->rel);
lwc_string_unref(link->hreflang);
lwc_string_unref(link->type);
lwc_string_unref(link->media);
lwc_string_unref(link->sizes);
free(link);

return next;
Expand Down
8 changes: 2 additions & 6 deletions content/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,7 @@ fetch_start(nsurl *url,
post_urlenc, post_multipart,
headers);
if (fetch->fetcher_handle == NULL) {

if (fetch->host != NULL)
lwc_string_unref(fetch->host);
lwc_string_unref(fetch->host);

if (fetch->url != NULL)
nsurl_unref(fetch->url);
Expand Down Expand Up @@ -574,9 +572,7 @@ void fetch_free(struct fetch *f)
if (f->referer != NULL) {
nsurl_unref(f->referer);
}
if (f->host != NULL) {
lwc_string_unref(f->host);
}
lwc_string_unref(f->host);
free(f);
}

Expand Down
3 changes: 1 addition & 2 deletions content/fetchers/about/about.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,7 @@ fetch_about_setup(struct fetch *fetchh,
}
}

if (path != NULL)
lwc_string_unref(path);
lwc_string_unref(path);

ctx->fetchh = fetchh;
ctx->url = nsurl_ref(url);
Expand Down
4 changes: 1 addition & 3 deletions content/fetchers/curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,7 @@ fetch_curl_setup(struct fetch *parent_fetch,
#undef APPEND

failed:
if (fetch->host != NULL)
lwc_string_unref(fetch->host);

lwc_string_unref(fetch->host);
nsurl_unref(fetch->url);
fetch_curl_free_postdata(fetch->postdata);
curl_slist_free_all(fetch->headers);
Expand Down
6 changes: 2 additions & 4 deletions content/handlers/css/css.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,12 @@ nscss_create(const content_handler *handler,
nscss_content_done, result);
if (error != NSERROR_OK) {
content_broadcast_error(&result->base, NSERROR_NOMEM, NULL);
if (charset_value != NULL)
lwc_string_unref(charset_value);
lwc_string_unref(charset_value);
free(result);
return error;
}

if (charset_value != NULL)
lwc_string_unref(charset_value);
lwc_string_unref(charset_value);

*c = (struct content *) result;

Expand Down
4 changes: 1 addition & 3 deletions content/handlers/html/box_manipulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ static int box_talloc_destructor(struct box *b)
if (b->href != NULL)
nsurl_unref(b->href);

if (b->id != NULL) {
lwc_string_unref(b->id);
}
lwc_string_unref(b->id);

if (b->node != NULL) {
dom_node_unref(b->node);
Expand Down
4 changes: 1 addition & 3 deletions content/handlers/html/box_special.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,7 @@ box_a(dom_node *n,
if (err == DOM_NO_ERR) {
/* name replaces existing id
* TODO: really? */
if (box->id != NULL)
lwc_string_unref(box->id);

lwc_string_unref(box->id);
box->id = lwc_name;
}
}
Expand Down
12 changes: 4 additions & 8 deletions content/handlers/html/dom_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,10 @@ static bool html_process_inserted_link(html_content *c, dom_node *node)
/* add to content */
content__add_rfc5988_link(&c->base, &link);

if (link.sizes != NULL)
lwc_string_unref(link.sizes);
if (link.media != NULL)
lwc_string_unref(link.media);
if (link.type != NULL)
lwc_string_unref(link.type);
if (link.hreflang != NULL)
lwc_string_unref(link.hreflang);
lwc_string_unref(link.sizes);
lwc_string_unref(link.media);
lwc_string_unref(link.type);
lwc_string_unref(link.hreflang);

nsurl_unref(link.href);
lwc_string_unref(link.rel);
Expand Down
12 changes: 4 additions & 8 deletions content/handlers/html/html.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,15 +1284,11 @@ static void html_destroy(struct content *c)
html->select_ctx = NULL;
}

if (html->universal != NULL) {
lwc_string_unref(html->universal);
html->universal = NULL;
}
lwc_string_unref(html->universal);
html->universal = NULL;

if (html->media.prefers_color_scheme != NULL) {
lwc_string_unref(html->media.prefers_color_scheme);
html->media.prefers_color_scheme = NULL;
}
lwc_string_unref(html->media.prefers_color_scheme);
html->media.prefers_color_scheme = NULL;

/* Free stylesheets */
html_css_free_stylesheets(html);
Expand Down
6 changes: 2 additions & 4 deletions content/handlers/text/textplain.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ static lwc_string *textplain_default_charset;
*/
static void textplain_fini(void)
{
if (textplain_default_charset != NULL) {
lwc_string_unref(textplain_default_charset);
textplain_default_charset = NULL;
}
lwc_string_unref(textplain_default_charset);
textplain_default_charset = NULL;
}


Expand Down
8 changes: 2 additions & 6 deletions content/hlcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,7 @@ hlcache_llcache_callback(llcache_handle *handle,
* prohibited, we must migrate the retrieval context. */
error = hlcache_migrate_ctx(ctx, effective_type);

if (effective_type != NULL)
lwc_string_unref(effective_type);
lwc_string_unref(effective_type);
}

/* No need to report that we need data:
Expand Down Expand Up @@ -496,10 +495,7 @@ hlcache_llcache_callback(llcache_handle *handle,
if (error == NSERROR_OK || error == NSERROR_NOT_FOUND) {
error = hlcache_migrate_ctx(ctx, effective_type);

if (effective_type != NULL) {
lwc_string_unref(effective_type);
}

lwc_string_unref(effective_type);
return error;
}

Expand Down
10 changes: 3 additions & 7 deletions content/urldb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2715,9 +2715,7 @@ static void urldb_destroy_path_node_content(struct path_data *node)
nsurl_unref(node->url);
}

if (node->scheme != NULL) {
lwc_string_unref(node->scheme);
}
lwc_string_unref(node->scheme);

free(node->segment);
for (i = 0; i < node->frag_cnt; i++)
Expand Down Expand Up @@ -3046,8 +3044,7 @@ nserror urldb_load(const char *filename)
}
nsurl_unref(nsurl);
lwc_string_unref(scheme_lwc);
if (fragment_lwc != NULL)
lwc_string_unref(fragment_lwc);
lwc_string_unref(fragment_lwc);

if (!fgets(s, MAXIMUM_URL_LENGTH, fp))
break;
Expand Down Expand Up @@ -3215,8 +3212,7 @@ bool urldb_add_url(nsurl *url)
}

lwc_string_unref(scheme);
if (fragment != NULL)
lwc_string_unref(fragment);
lwc_string_unref(fragment);

return (p != NULL);
}
Expand Down
8 changes: 2 additions & 6 deletions desktop/browser_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ browser_window_history__clone_entry(struct history *history,
new_child = browser_window_history__clone_entry(history, child);
if (new_child == NULL) {
nsurl_unref(new_entry->page.url);
if (new_entry->page.frag_id) {
lwc_string_unref(new_entry->page.frag_id);
}
lwc_string_unref(new_entry->page.frag_id);
free(new_entry->page.title);
if (entry->page.bitmap != NULL) {
guit->bitmap->destroy(entry->page.bitmap);
Expand Down Expand Up @@ -172,9 +170,7 @@ static void browser_window_history__free_entry(struct history_entry *entry)
browser_window_history__free_entry(entry->next);

nsurl_unref(entry->page.url);
if (entry->page.frag_id) {
lwc_string_unref(entry->page.frag_id);
}
lwc_string_unref(entry->page.frag_id);
free(entry->page.title);
if (entry->page.bitmap != NULL) {
guit->bitmap->destroy(entry->page.bitmap);
Expand Down
16 changes: 4 additions & 12 deletions desktop/browser_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1905,9 +1905,7 @@ nserror browser_window_destroy_internal(struct browser_window *bw)

/* These simply free memory, so are safe here */

if (bw->frag_id != NULL) {
lwc_string_unref(bw->frag_id);
}
lwc_string_unref(bw->frag_id);

browser_window_history_destroy(bw);

Expand Down Expand Up @@ -3399,9 +3397,7 @@ browser_window_navigate(struct browser_window *bw,
return error;
}

if (bw->frag_id != NULL) {
lwc_string_unref(bw->frag_id);
}
lwc_string_unref(bw->frag_id);
bw->frag_id = NULL;

if (nsurl_has_component(url, NSURL_FRAGMENT)) {
Expand Down Expand Up @@ -3821,9 +3817,7 @@ browser_window__navigate_internal(struct browser_window *bw,
lwc_string_unref(path);
return navigate_internal_query_fetcherror(bw, params);
}
if (path != NULL) {
lwc_string_unref(path);
}
lwc_string_unref(path);

/* Fall through to a normal about: fetch */

Expand Down Expand Up @@ -4762,9 +4756,7 @@ nserror browser_window_show_cookies(

err = guit->misc->present_cookies(string);

if (host != NULL) {
lwc_string_unref(host);
}
lwc_string_unref(host);
return err;
}

Expand Down
9 changes: 3 additions & 6 deletions desktop/cookie_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,7 @@ static nserror cookie_manager_init_entry_fields(void)

error:
for (i = 0; i < COOKIE_M_N_FIELDS; i++)
if (cm_ctx.fields[i].field != NULL)
lwc_string_unref(cm_ctx.fields[i].field);
lwc_string_unref(cm_ctx.fields[i].field);

return NSERROR_UNKNOWN;
}
Expand Down Expand Up @@ -858,13 +857,11 @@ nserror cookie_manager_fini(void)

/* Free cookie manager treeview entry fields */
for (i = 0; i < COOKIE_M_N_FIELDS; i++)
if (cm_ctx.fields[i].field != NULL)
lwc_string_unref(cm_ctx.fields[i].field);
lwc_string_unref(cm_ctx.fields[i].field);

/* Free cookie manager treeview common entry values */
for (i = 0; i < COOKIE_M_N_VALUES; i++)
if (cm_ctx.values[i].value != NULL)
free((void *) cm_ctx.values[i].value);
free((void *) cm_ctx.values[i].value);

err = treeview_fini();
if (err != NSERROR_OK) {
Expand Down
3 changes: 1 addition & 2 deletions desktop/download.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ void download_context_destroy(download_context *ctx)
{
llcache_handle_release(ctx->llcache);

if (ctx->mime_type != NULL)
lwc_string_unref(ctx->mime_type);
lwc_string_unref(ctx->mime_type);

free(ctx->filename);

Expand Down
6 changes: 2 additions & 4 deletions desktop/global_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ static nserror global_history_initialise_entry_fields(void)

error:
for (i = 0; i < N_FIELDS; i++)
if (gh_ctx.fields[i].field != NULL)
lwc_string_unref(gh_ctx.fields[i].field);
lwc_string_unref(gh_ctx.fields[i].field);

return NSERROR_UNKNOWN;
}
Expand Down Expand Up @@ -811,8 +810,7 @@ nserror global_history_fini(void)

/* Free global history treeview entry fields */
for (i = 0; i < N_FIELDS; i++)
if (gh_ctx.fields[i].field != NULL)
lwc_string_unref(gh_ctx.fields[i].field);
lwc_string_unref(gh_ctx.fields[i].field);

err = treeview_fini();
if (err != NSERROR_OK) {
Expand Down
6 changes: 2 additions & 4 deletions desktop/hotlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,8 +1252,7 @@ static nserror hotlist_initialise_entry_fields(void)

error:
for (i = 0; i < HL_N_FIELDS; i++)
if (hl_ctx.fields[i].field != NULL)
lwc_string_unref(hl_ctx.fields[i].field);
lwc_string_unref(hl_ctx.fields[i].field);

return NSERROR_UNKNOWN;
}
Expand Down Expand Up @@ -1412,8 +1411,7 @@ nserror hotlist_fini(void)

/* Free hotlist treeview entry fields */
for (i = 0; i < HL_N_FIELDS; i++)
if (hl_ctx.fields[i].field != NULL)
lwc_string_unref(hl_ctx.fields[i].field);
lwc_string_unref(hl_ctx.fields[i].field);

err = treeview_fini();
if (err != NSERROR_OK) {
Expand Down
8 changes: 2 additions & 6 deletions desktop/page-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,7 @@ nserror page_info_create(struct core_window *cw_h,
/* Exported interface documented in desktop/page_info.h */
nserror page_info_destroy(struct page_info *pi)
{
if (pi->domain != NULL) {
lwc_string_unref(pi->domain);
}
lwc_string_unref(pi->domain);
free(pi);
return NSERROR_OK;
}
Expand All @@ -581,9 +579,7 @@ nserror page_info_set(struct page_info *pgi, struct browser_window *bw)
{
nserror res;

if (pgi->domain != NULL) {
lwc_string_unref(pgi->domain);
}
lwc_string_unref(pgi->domain);

res = page_info__create_from_bw(pgi, bw);
if (res == NSERROR_OK) {
Expand Down
8 changes: 4 additions & 4 deletions frontends/amiga/filetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ static void ami_mime_entry_free(void *nso)
{
struct ami_mime_entry *mimeentry = (struct ami_mime_entry *)nso;

if(mimeentry->mimetype) lwc_string_unref(mimeentry->mimetype);
if(mimeentry->datatype) lwc_string_unref(mimeentry->datatype);
if(mimeentry->filetype) lwc_string_unref(mimeentry->filetype);
if(mimeentry->plugincmd) lwc_string_unref(mimeentry->plugincmd);
lwc_string_unref(mimeentry->mimetype);
lwc_string_unref(mimeentry->datatype);
lwc_string_unref(mimeentry->filetype);
lwc_string_unref(mimeentry->plugincmd);
}

nserror ami_mime_init(const char *mimefile)
Expand Down
Loading
Loading