Copy data and free data with free().

2001-02-19 Alexander Larsson  <alexl@redhat.com>

	* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
	Copy data and free data with free().

	* gdk-pixbuf/gdk-pixbuf.c:
	* gdk-pixbuf/io-jpeg.c:
	* gdk-pixbuf/io-png.c:
	Use g_try_malloc/g_free instead malloc/free.

	* gdk-pixbuf/test-gdk-pixbuf.c:
	Must... initialize... gobject...

	* gdk-pixbuf/pixops/timescale.c:
	* gtk/gtkcalendar.c:
	Use g_malloc instead of malloc.
This commit is contained in:
Alexander Larsson 2001-02-19 14:35:25 +00:00 committed by Alexander Larsson
parent 1f6effe99b
commit ba46da61a7
14 changed files with 148 additions and 21 deletions

View File

@ -1,4 +1,21 @@
2001-02-19 <alla@lysator.liu.se>
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
Copy data and free data with free().
* gdk-pixbuf/gdk-pixbuf.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-png.c:
Use g_try_malloc/g_free instead malloc/free.
* gdk-pixbuf/test-gdk-pixbuf.c:
Must... initialize... gobject...
* gdk-pixbuf/pixops/timescale.c:
* gtk/gtkcalendar.c:
Use g_malloc instead of malloc.
2001-02-19 Alexander Larsson <alla@lysator.liu.se>
* gtk/testgtkrc:
Comment out property assignments, these don't work yet.

View File

@ -1,4 +1,21 @@
2001-02-19 <alla@lysator.liu.se>
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
Copy data and free data with free().
* gdk-pixbuf/gdk-pixbuf.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-png.c:
Use g_try_malloc/g_free instead malloc/free.
* gdk-pixbuf/test-gdk-pixbuf.c:
Must... initialize... gobject...
* gdk-pixbuf/pixops/timescale.c:
* gtk/gtkcalendar.c:
Use g_malloc instead of malloc.
2001-02-19 Alexander Larsson <alla@lysator.liu.se>
* gtk/testgtkrc:
Comment out property assignments, these don't work yet.

View File

@ -1,4 +1,21 @@
2001-02-19 <alla@lysator.liu.se>
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
Copy data and free data with free().
* gdk-pixbuf/gdk-pixbuf.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-png.c:
Use g_try_malloc/g_free instead malloc/free.
* gdk-pixbuf/test-gdk-pixbuf.c:
Must... initialize... gobject...
* gdk-pixbuf/pixops/timescale.c:
* gtk/gtkcalendar.c:
Use g_malloc instead of malloc.
2001-02-19 Alexander Larsson <alla@lysator.liu.se>
* gtk/testgtkrc:
Comment out property assignments, these don't work yet.

View File

@ -1,4 +1,21 @@
2001-02-19 <alla@lysator.liu.se>
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
Copy data and free data with free().
* gdk-pixbuf/gdk-pixbuf.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-png.c:
Use g_try_malloc/g_free instead malloc/free.
* gdk-pixbuf/test-gdk-pixbuf.c:
Must... initialize... gobject...
* gdk-pixbuf/pixops/timescale.c:
* gtk/gtkcalendar.c:
Use g_malloc instead of malloc.
2001-02-19 Alexander Larsson <alla@lysator.liu.se>
* gtk/testgtkrc:
Comment out property assignments, these don't work yet.

View File

@ -1,4 +1,21 @@
2001-02-19 <alla@lysator.liu.se>
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
Copy data and free data with free().
* gdk-pixbuf/gdk-pixbuf.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-png.c:
Use g_try_malloc/g_free instead malloc/free.
* gdk-pixbuf/test-gdk-pixbuf.c:
Must... initialize... gobject...
* gdk-pixbuf/pixops/timescale.c:
* gtk/gtkcalendar.c:
Use g_malloc instead of malloc.
2001-02-19 Alexander Larsson <alla@lysator.liu.se>
* gtk/testgtkrc:
Comment out property assignments, these don't work yet.

View File

@ -1,4 +1,21 @@
2001-02-19 <alla@lysator.liu.se>
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
Copy data and free data with free().
* gdk-pixbuf/gdk-pixbuf.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-png.c:
Use g_try_malloc/g_free instead malloc/free.
* gdk-pixbuf/test-gdk-pixbuf.c:
Must... initialize... gobject...
* gdk-pixbuf/pixops/timescale.c:
* gtk/gtkcalendar.c:
Use g_malloc instead of malloc.
2001-02-19 Alexander Larsson <alla@lysator.liu.se>
* gtk/testgtkrc:
Comment out property assignments, these don't work yet.

View File

@ -1,4 +1,21 @@
2001-02-19 <alla@lysator.liu.se>
2001-02-19 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkimage-fb.c (gdk_image_new_bitmap):
Copy data and free data with free().
* gdk-pixbuf/gdk-pixbuf.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-png.c:
Use g_try_malloc/g_free instead malloc/free.
* gdk-pixbuf/test-gdk-pixbuf.c:
Must... initialize... gobject...
* gdk-pixbuf/pixops/timescale.c:
* gtk/gtkcalendar.c:
Use g_malloc instead of malloc.
2001-02-19 Alexander Larsson <alla@lysator.liu.se>
* gtk/testgtkrc:
Comment out property assignments, these don't work yet.

View File

@ -117,7 +117,7 @@ gdk_pixbuf_unref (GdkPixbuf *pixbuf)
static void
free_buffer (guchar *pixels, gpointer data)
{
free (pixels);
g_free (pixels);
}
/**
@ -153,7 +153,7 @@ gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sampl
channels = has_alpha ? 4 : 3;
rowstride = 4 * ((channels * width + 3) / 4);
buf = malloc (height * rowstride);
buf = g_try_malloc (height * rowstride);
if (!buf)
return NULL;
@ -188,7 +188,7 @@ gdk_pixbuf_copy (const GdkPixbuf *pixbuf)
size = ((pixbuf->height - 1) * pixbuf->rowstride +
pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));
buf = malloc (size * sizeof (guchar));
buf = g_try_malloc (size * sizeof (guchar));
if (!buf)
return NULL;

View File

@ -145,7 +145,7 @@ output_message_handler (j_common_ptr cinfo)
static void
free_buffer (guchar *pixels, gpointer data)
{
free (pixels);
g_free (pixels);
}
@ -222,7 +222,7 @@ gdk_pixbuf__jpeg_image_load (FILE *f, GError **error)
w = cinfo.output_width;
h = cinfo.output_height;
pixels = malloc (h * w * 3);
pixels = g_try_malloc (h * w * 3);
if (!pixels) {
jpeg_destroy_decompress (&cinfo);

View File

@ -176,7 +176,7 @@ png_simple_warning_callback(png_structp png_save_ptr,
static void
free_buffer (guchar *pixels, gpointer data)
{
free (pixels);
g_free (pixels);
}
/* Shared library entry point */
@ -230,7 +230,7 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
else
bpp = 3;
pixels = malloc (w * h * bpp);
pixels = g_try_malloc (w * h * bpp);
if (!pixels) {
/* Check error NULL, normally this would be broken,
* but libpng makes me want to code defensively.
@ -701,7 +701,7 @@ gdk_pixbuf__png_image_save (FILE *f,
png_set_IHDR (png_ptr, info_ptr, w, h, bpc,
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
data = malloc (w * 3 * sizeof (char));
data = g_try_malloc (w * 3 * sizeof (char));
if (data == NULL) {
/* Check error NULL, normally this would be broken,
@ -741,7 +741,7 @@ gdk_pixbuf__png_image_save (FILE *f,
}
if (data)
free (data);
g_free (data);
png_write_end (png_ptr, info_ptr);
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);

View File

@ -146,10 +146,10 @@ int main (int argc, char **argv)
int filter_level;
src_buf = malloc(src_rowstride * src_height);
src_buf = g_malloc(src_rowstride * src_height);
memset (src_buf, 0x80, src_rowstride * src_height);
dest_buf = malloc(dest_rowstride * dest_height);
dest_buf = g_malloc(dest_rowstride * dest_height);
memset (dest_buf, 0x80, dest_rowstride * dest_height);
for (filter_level = GDK_INTERP_NEAREST ; filter_level <= GDK_INTERP_HYPER; filter_level++)
@ -216,8 +216,8 @@ int main (int argc, char **argv)
}
printf ("\n");
free (src_buf);
free (dest_buf);
g_free (src_buf);
g_free (dest_buf);
}
printf ("SCALE\n=====\n\n");

View File

@ -25,6 +25,7 @@
#include <stdlib.h>
#include "gdk-pixbuf.h"
#include <gobject/gtype.h>
@ -228,6 +229,8 @@ main (int argc, char **argv)
int result;
result = EXIT_SUCCESS;
g_type_init (G_TYPE_DEBUG_NONE);
/* Run some tests. */
if (!simple_composite_test ()) {

View File

@ -126,7 +126,12 @@ gdk_image_new_bitmap(GdkVisual *visual,
image->bpp = 1;
image->bpl = (w+7)/8;
image->mem = g_malloc (image->bpl * h / 8);
memcpy (image->mem, data, image->bpl * h / 8);
/* This must be freed using free, not g_free, since in the X version
this is freed by xlib. */
free (data);
return image;
}

View File

@ -430,7 +430,7 @@ gtk_calendar_init (GtkCalendar *calendar)
widget = GTK_WIDGET (calendar);
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
calendar->private_data = (gpointer) malloc (sizeof (GtkCalendarPrivateData));
calendar->private_data = (gpointer) g_malloc (sizeof (GtkCalendarPrivateData));
private_data = GTK_CALENDAR_PRIVATE_DATA (calendar);
if (!default_abbreviated_dayname[0])