mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
mem_free_if where aplicable. Initialised memory in encoding/*
This commit is contained in:
parent
ca4d770c0b
commit
c84dfd7e18
@ -90,7 +90,7 @@ new_menu_item(struct list_menu *menu, unsigned char *name, int data, int fullnam
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!stack || !new_menu_item) {
|
if (!stack || !new_menu_item) {
|
||||||
if (new_menu_item) mem_free(new_menu_item);
|
mem_free_if(new_menu_item);
|
||||||
mem_free(name);
|
mem_free(name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ html_input_format(struct html_context *html_context, unsigned char *a,
|
|||||||
html_stack_dup(html_context, ELEMENT_KILLABLE);
|
html_stack_dup(html_context, ELEMENT_KILLABLE);
|
||||||
html_focusable(html_context, a);
|
html_focusable(html_context, a);
|
||||||
format.form = fc;
|
format.form = fc;
|
||||||
if (format.title) mem_free(format.title);
|
mem_free_if(format.title);
|
||||||
format.title = get_attr_val(a, "title", html_context->doc_cp);
|
format.title = get_attr_val(a, "title", html_context->doc_cp);
|
||||||
switch (fc->type) {
|
switch (fc->type) {
|
||||||
case FC_TEXT:
|
case FC_TEXT:
|
||||||
|
@ -98,7 +98,7 @@ kill_html_stack_item(struct html_context *html_context, struct html_element *e)
|
|||||||
add_to_string_list(&html_context->part->document->onload_snippets,
|
add_to_string_list(&html_context->part->document->onload_snippets,
|
||||||
onload, -1);
|
onload, -1);
|
||||||
}
|
}
|
||||||
if (onload) mem_free(onload);
|
mem_free_if(onload);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mem_free_if(e->attr.link);
|
mem_free_if(e->attr.link);
|
||||||
|
@ -899,7 +899,7 @@ draw_table_cell(struct table *table, int col, int row, int x, int y,
|
|||||||
|
|
||||||
done_html_parser_state(html_context, state);
|
done_html_parser_state(html_context, state);
|
||||||
|
|
||||||
if (part) mem_free(part);
|
mem_free_if(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -67,6 +67,7 @@ bzip2_open(struct stream_encoded *stream, int fd)
|
|||||||
copy_struct(&data->fbz_stream, &null_bz_stream);
|
copy_struct(&data->fbz_stream, &null_bz_stream);
|
||||||
data->fdread = fd;
|
data->fdread = fd;
|
||||||
data->last_read = 0;
|
data->last_read = 0;
|
||||||
|
data->after_end = 0;
|
||||||
|
|
||||||
err = BZ2_bzDecompressInit(&data->fbz_stream, 0, 0);
|
err = BZ2_bzDecompressInit(&data->fbz_stream, 0, 0);
|
||||||
if (err != BZ_OK) {
|
if (err != BZ_OK) {
|
||||||
@ -189,7 +190,7 @@ bzip2_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int
|
|||||||
*new_len = stream->total_out_lo32;
|
*new_len = stream->total_out_lo32;
|
||||||
return buffer;
|
return buffer;
|
||||||
} else {
|
} else {
|
||||||
if (buffer) mem_free(buffer);
|
mem_free_if(buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ deflate_decode_buffer(struct stream_encoded *st, int window_size, unsigned char
|
|||||||
*new_len = stream->total_out;
|
*new_len = stream->total_out;
|
||||||
return buffer;
|
return buffer;
|
||||||
} else {
|
} else {
|
||||||
if (buffer) mem_free(buffer);
|
mem_free_if(buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ lzma_open(struct stream_encoded *stream, int fd)
|
|||||||
memset(&data->flzma_stream, 0, sizeof(data->flzma_stream));
|
memset(&data->flzma_stream, 0, sizeof(data->flzma_stream));
|
||||||
data->fdread = fd;
|
data->fdread = fd;
|
||||||
data->last_read = 0;
|
data->last_read = 0;
|
||||||
|
data->after_end = 0;
|
||||||
|
|
||||||
err = lzma_auto_decoder(&data->flzma_stream, ELINKS_LZMA_MEMORY_LIMIT, 0);
|
err = lzma_auto_decoder(&data->flzma_stream, ELINKS_LZMA_MEMORY_LIMIT, 0);
|
||||||
if (err != LZMA_OK) {
|
if (err != LZMA_OK) {
|
||||||
@ -153,7 +154,7 @@ lzma_decode_buffer(struct stream_encoded *st, unsigned char *data, int len, int
|
|||||||
*new_len = stream->total_out;
|
*new_len = stream->total_out;
|
||||||
return buffer;
|
return buffer;
|
||||||
} else {
|
} else {
|
||||||
if (buffer) mem_free(buffer);
|
mem_free_if(buffer);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ add_bittorrent_selection(struct uri *uri, int *selection, size_t size)
|
|||||||
int *duplicate;
|
int *duplicate;
|
||||||
|
|
||||||
duplicate = get_bittorrent_selection(uri, size);
|
duplicate = get_bittorrent_selection(uri, size);
|
||||||
if (duplicate) mem_free(duplicate);
|
mem_free_if(duplicate);
|
||||||
|
|
||||||
info = mem_calloc(1, sizeof(*info));
|
info = mem_calloc(1, sizeof(*info));
|
||||||
if (!info) return;
|
if (!info) return;
|
||||||
|
@ -37,7 +37,7 @@ smjs_action_fn_finalize(JSContext *ctx, JSObject *obj)
|
|||||||
hop = JS_GetInstancePrivate(ctx, obj,
|
hop = JS_GetInstancePrivate(ctx, obj,
|
||||||
(JSClass *) &action_fn_class, NULL);
|
(JSClass *) &action_fn_class, NULL);
|
||||||
|
|
||||||
if (hop) mem_free(hop);
|
mem_free_if(hop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @action_fn_class.call */
|
/* @action_fn_class.call */
|
||||||
|
Loading…
Reference in New Issue
Block a user