Displaying 20 results from an estimated 64 matches for "g_malloc".
Did you mean:
p_malloc
2008 May 25
1
[RFC] check return of mallocs in swfdec/jpeg/
hi,
this patch checks the returns of most malloc functions called in
swfdec/jpeg. This should fix bug #15528. Don't know if you like gotos :)
This incorporates the patch attached to message "[PATCH] fix leak in
jpeg_decode_argb".
thanks,
rm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check-malloc-return.diff
Type: text/x-diff
Size: 3922
2007 Sep 17
0
2 commits - libswfdec/swfdec_bits.c
...radient *
-swfdec_bits_do_get_gradient (SwfdecBits *bits, gboolean alpha)
+swfdec_bits_do_get_gradient (SwfdecBits *bits, gboolean alpha, gboolean morph)
{
SwfdecGradient *grad;
guint i, n_gradients;
n_gradients = swfdec_bits_get_u8 (bits);
+ if (morph)
+ n_gradients *= 2;
grad = g_malloc (sizeof (SwfdecGradient) +
sizeof (SwfdecGradientEntry) * (MAX (n_gradients, 1) - 1));
for (i = 0; i < n_gradients && swfdec_bits_left (bits); i++) {
@@ -625,35 +627,19 @@ swfdec_bits_do_get_gradient (SwfdecBits
SwfdecGradient *
swfdec_bits_get_gradient (SwfdecBits * bits)...
2007 Apr 22
0
3 commits - libswfdec/swfdec_bits.c libswfdec/swfdec_font.c libswfdec/swfdec_movie.c
...n no more bits are available
diff --git a/libswfdec/swfdec_bits.c b/libswfdec/swfdec_bits.c
index 0f7e4c9..7077cdc 100644
--- a/libswfdec/swfdec_bits.c
+++ b/libswfdec/swfdec_bits.c
@@ -585,11 +585,15 @@ swfdec_bits_get_gradient (SwfdecBits * b
n_gradients = swfdec_bits_get_u8 (bits);
grad = g_malloc (sizeof (SwfdecGradient) +
sizeof (SwfdecGradientEntry) * (n_gradients - 1));
- grad->n_gradients = n_gradients;
- for (i = 0; i < n_gradients; i++) {
+ for (i = 0; i < n_gradients && swfdec_bits_left (bits); i++) {
grad->array[i].ratio = swfdec_bits_get_u8 (bits)...
2007 Oct 26
0
8 commits - doc/swfdec-sections.txt libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_interpret.c test/trace
...g_return_if_fail (SWFDEC_IS_AS_FRAME (frame));
g_return_if_fail (try_data != NULL);
@@ -2619,13 +2619,13 @@ swfdec_action_try_end_catch (SwfdecAsFrame *frame, gpointer data)
// create new block for finally, passing the exception
// clear exception from the context
- exception = g_malloc (sizeof (SwfdecAsValue));
- *exception = val;
+ exception_value = g_malloc (sizeof (SwfdecAsValue));
+ *exception_value = val;
// FIXME: the exception value is not marked while finally block runs
swfdec_as_frame_push_block (frame, try_data->finally_start,
try_data->fina...
2007 Oct 26
0
3 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_interpret.c
...swfdec_action_try_data_ref (try_data);
swfdec_as_frame_pop_block (frame);
- if (cx->throwing) {
+ if (cx->throwing)
+ {
+ // we got an exception while in catch block:
+ // create new block for finally, passing the exception
+ // clear exception from the context
+
error = g_malloc (sizeof (SwfdecAsValue));
*error = cx->throw_value;
@@ -2611,7 +2634,7 @@ swfdec_action_try_end_catch (SwfdecAsFrame *frame, gpointer data)
SWFDEC_AS_VALUE_SET_UNDEFINED (&cx->throw_value);
}
- swfdec_action_try_free_data (try_data);
+ swfdec_action_try_data_unref (try_...
2002 Jul 10
0
history patch (was Re: portable snprintf implementation)
...les/gnome/gtkconsole.c Wed Jul 10 16:21:30 2002
***************
*** 299,312 ****
/* add command to history */
term_ptr = strchr (text_chars, '\n');
if ((add_to_history == TRUE) && (term_ptr != NULL) && (*text_chars !=
'\n'))
! {
! history_buf = g_malloc (term_ptr - text_chars + 1);
! *term_ptr = '\0';
! strncpy (history_buf, text_chars, term_ptr - text_chars + 1);
! GTK_CONSOLE (object)->history =
! g_list_prepend (GTK_CONSOLE (object)->history, history_buf);
! GTK_CONSOLE (object)->history_num_items++;...
2007 Nov 10
1
3 commits - libswfdec/swfdec_image.c libswfdec/swfdec_image.h
...uint8 *data;
int have_alpha = (image->type == SWFDEC_IMAGE_TYPE_LOSSLESS2);
swfdec_bits_init (&bits, image->raw_data);
@@ -348,15 +357,14 @@ swfdec_image_lossless_load (SwfdecImage *image)
guint i;
guint rowstride = (image->width + 3) & ~3;
- image->data = g_malloc (4 * image->width * image->height);
- image->rowstride = image->width * 4;
+ data = g_malloc (4 * image->width * image->height);
if (have_alpha) {
buffer = swfdec_bits_decompress (&bits, -1, color_table_size * 4 + rowstride * image->height);
if (b...
2007 Feb 06
0
Branch 'interpreter' - 8 commits - libswfdec/swfdec_bits.c libswfdec/swfdec_color.c libswfdec/swfdec_color.h libswfdec/swfdec_edittext.c libswfdec/swfdec_image.c libswfdec/swfdec_image.h libswfdec/swfdec_pattern.c libswfdec/swfdec_sprite.c test/dump.c
...height);
- ptr = lossless (bits.ptr, endptr - bits.ptr, &len);
- bits.ptr = endptr;
if (format == 3) {
- unsigned char *color_table;
unsigned char *indexed_data;
- int i;
+ guint i;
+ unsigned int rowstride = (image->width + 3) & ~3;
- image_data = g_malloc (4 * image->width * image->height);
+ image->data = g_malloc (4 * image->width * image->height);
image->rowstride = image->width * 4;
- color_table = g_malloc (color_table_size * 4);
-
if (have_alpha) {
+ ptr = lossless (bits.ptr, bits.end - bits.p...
2016 Aug 24
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...+ char *filename = NULL;
> + int fd, idx;
> + struct stat stbuf;
> + struct pstore_read_arg *rarg = NULL;
> + Error *err = NULL;
> + int ret = -1;
> +
> + if (s->file_idx >= s->num_file) {
> + return 0;
> + }
> +
> + rarg = g_malloc(sizeof(*rarg));
> + if (rarg == NULL) {
> + return -1;
> + }
> +
> + idx = s->file_idx++;
> + filename = virtio_pstore_from_filename(s, s->files[idx]->d_name,
> + &rarg->info);
> + if (filename =...
2016 Aug 24
2
[PATCH 2/3] qemu: Implement virtio-pstore device
...+ char *filename = NULL;
> + int fd, idx;
> + struct stat stbuf;
> + struct pstore_read_arg *rarg = NULL;
> + Error *err = NULL;
> + int ret = -1;
> +
> + if (s->file_idx >= s->num_file) {
> + return 0;
> + }
> +
> + rarg = g_malloc(sizeof(*rarg));
> + if (rarg == NULL) {
> + return -1;
> + }
> +
> + idx = s->file_idx++;
> + filename = virtio_pstore_from_filename(s, s->files[idx]->d_name,
> + &rarg->info);
> + if (filename =...
2007 Apr 18
0
6 commits - libswfdec-gtk/swfdec_gtk_widget.c libswfdec/jpeg libswfdec/swfdec_image.c
...data2 += 2;
- length2 -= 2;
- }
- while (length2 >= 2 && data2[length2-2] == 0xff &&
- (data2[length2-1] == 0xd9 || data2[length2-1] == 0xd8)) {
- length2 -= 2;
- }
- } else {
- length2 = 0;
- }
-
- tmplength = length1 + length2 + 4;
- tmpdata = g_malloc (tmplength);
+ unsigned char *tmpdata;
+ int tmplength;
- tmpdata[0] = 0xff;
- tmpdata[1] = 0xd8;
- memcpy (tmpdata + 2, data1, length1);
- memcpy (tmpdata + 2 + length1, data2, length2);
- tmpdata[2 + length1 + length2] = 0xff;
- tmpdata[2 + length1 + length2 + 1] = 0xd9;
+ tmplen...
2016 Aug 26
0
[PATCH 2/3] qemu: Implement virtio-pstore device
...> > + struct stat stbuf;
> > + struct pstore_read_arg *rarg = NULL;
> > + Error *err = NULL;
> > + int ret = -1;
> > +
> > + if (s->file_idx >= s->num_file) {
> > + return 0;
> > + }
> > +
> > + rarg = g_malloc(sizeof(*rarg));
> > + if (rarg == NULL) {
> > + return -1;
> > + }
> > +
> > + idx = s->file_idx++;
> > + filename = virtio_pstore_from_filename(s, s->files[idx]->d_name,
> > + &rarg-...
2007 Feb 13
0
libswfdec/jpeg libswfdec/swfdec_image.c
..._oversample, dec->components[i].h_oversample);
@@ -263,13 +267,11 @@ jpeg_decoder_sof_baseline_dct (JpegDecod
(dec->height_blocks * 8 * max_v_oversample /
dec->components[i].v_subsample);
dec->components[i].rowstride = rowstride;
- dec->components[i].image = g_malloc (image_size);
+ dec->components[i].image = malloc (image_size);
}
-#ifdef JPEG_DEBUG_ON
if (bits->end != bits->ptr)
- JPEG_WARNING ("endptr != bits");
-#endif
+ OIL_DEBUG ("endptr != bits");
return length;
}
@@ -283,7 +285,7 @@ jpeg_decoder_define...
2018 May 13
0
[PATCH libldm] Fix crash while creating mapper for a volume which lacks all components.
...615,7 +2615,7 @@ _dm_create_part(const LDMPartitionPrivate * const part, uint32_t cookie,
static GString *
_dm_create_spanned(const LDMVolumePrivate * const vol, GError ** const err)
{
- static GString *name = NULL;
+ GString *name = NULL;
guint i = 0;
struct dm_target *targets = g_malloc(sizeof(*targets) * vol->parts->len);
@@ -2682,7 +2682,7 @@ out:
static GString *
_dm_create_striped(const LDMVolumePrivate * const vol, GError ** const err)
{
- static GString *name = NULL;
+ GString *name = NULL;
struct dm_target target;
target.start = 0;
--
2.17.0
2018 May 15
0
[PATCH libldm v2 1/1] Fix crash while creating mapper for a volume which lacks of partitions.
...615,7 +2615,7 @@ _dm_create_part(const LDMPartitionPrivate * const part, uint32_t cookie,
static GString *
_dm_create_spanned(const LDMVolumePrivate * const vol, GError ** const err)
{
- static GString *name = NULL;
+ GString *name = NULL;
guint i = 0;
struct dm_target *targets = g_malloc(sizeof(*targets) * vol->parts->len);
@@ -2682,7 +2682,7 @@ out:
static GString *
_dm_create_striped(const LDMVolumePrivate * const vol, GError ** const err)
{
- static GString *name = NULL;
+ GString *name = NULL;
struct dm_target target;
target.start = 0;
@@ -2961,7 +2...
2018 May 15
1
[PATCH libldm v2 0/1] Fix crash while creating mapper for a volume which lacks of partitions.
v1 was here:
https://www.redhat.com/archives/libguestfs/2018-May/msg00058.html
v2:
- more correct explanation of a crash reason.
Mykola Ivanets (1):
Fix crash while creating mapper for a volume which lacks of
partitions.
src/ldm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
2.17.0
2007 May 01
0
2 commits - libswfdec/swfdec_bits.c
...nts was 0, that could happen
diff --git a/libswfdec/swfdec_bits.c b/libswfdec/swfdec_bits.c
index b74846e..c8a5062 100644
--- a/libswfdec/swfdec_bits.c
+++ b/libswfdec/swfdec_bits.c
@@ -587,7 +587,7 @@ swfdec_bits_get_gradient (SwfdecBits * b
n_gradients = swfdec_bits_get_u8 (bits);
grad = g_malloc (sizeof (SwfdecGradient) +
- sizeof (SwfdecGradientEntry) * (n_gradients - 1));
+ sizeof (SwfdecGradientEntry) * (MAX (n_gradients, 1) - 1));
for (i = 0; i < n_gradients && swfdec_bits_left (bits); i++) {
grad->array[i].ratio = swfdec_bits_get_u8 (bits);
grad-&g...
2007 Jan 26
0
libswfdec/swfdec_image.c libswfdec/swfdec_image.h libswfdec/swfdec_pattern.c
...t;width);
SWFDEC_LOG (" height = %d", image->height);
@@ -464,6 +464,7 @@ swfdec_image_lossless_load (SwfdecImage
if (have_alpha) {
SWFDEC_INFO("16bit images aren't allowed to have alpha, ignoring");
+ have_alpha = FALSE;
}
image_data = g_malloc (4 * image->width * image->height);
@@ -513,7 +514,7 @@ swfdec_image_lossless_load (SwfdecImage
}
}
- swfdec_image_create_surface (image, image_data);
+ swfdec_image_create_surface (image, image_data, have_alpha);
}
int
@@ -626,3 +627,33 @@ swfdec_image_get_surface (SwfdecIma...
2007 Jan 29
0
Branch 'interpreter' - 18 commits - libswfdec/swfdec_image.c libswfdec/swfdec_image.h libswfdec/swfdec_js.c libswfdec/swfdec_js_color.c libswfdec/swfdec_js_sound.c libswfdec/swfdec_pattern.c libswfdec/swfdec_scriptable.c libswfdec/swfdec_script.c
...= lossless (bits.ptr, endptr - bits.ptr, image->width * image->height);
- bits.ptr = endptr;
if (format == 3) {
- unsigned char *color_table;
unsigned char *indexed_data;
- int i;
+ guint i;
+ unsigned int rowstride = (image->width + 3) & ~3;
image_data = g_malloc (4 * image->width * image->height);
image->rowstride = image->width * 4;
- color_table = g_malloc (color_table_size * 4);
-
if (have_alpha) {
+ ptr = lossless (bits.ptr, bits.end - bits.ptr,
+ color_table_size * 4 + rowstride * image->height);
for (i = 0...
2007 Feb 06
0
21 commits - configure.ac libswfdec/swfdec_audio_event.c libswfdec/swfdec_bits.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_color.c libswfdec/swfdec_color.h libswfdec/swfdec_compiler.c libswfdec/swfdec_edittext.c libswfdec/swfdec_image.c
...endptr;
SwfdecBits bits;
- unsigned char *image_data = NULL;
int have_alpha = (image->type == SWFDEC_IMAGE_TYPE_LOSSLESS2);
bits.buffer = image->raw_data;
@@ -414,7 +391,7 @@ swfdec_image_lossless_load (SwfdecImage
unsigned char *indexed_data;
int i;
- image_data = g_malloc (4 * image->width * image->height);
+ image->data = g_malloc (4 * image->width * image->height);
image->rowstride = image->width * 4;
color_table = g_malloc (color_table_size * 4);
@@ -450,7 +427,7 @@ swfdec_image_lossless_load (SwfdecImage
}
index...