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:
committed by
Alexander Larsson
parent
1f6effe99b
commit
ba46da61a7
19
ChangeLog
19
ChangeLog
@ -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:
|
* gtk/testgtkrc:
|
||||||
Comment out property assignments, these don't work yet.
|
Comment out property assignments, these don't work yet.
|
||||||
|
|||||||
@ -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:
|
* gtk/testgtkrc:
|
||||||
Comment out property assignments, these don't work yet.
|
Comment out property assignments, these don't work yet.
|
||||||
|
|||||||
@ -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:
|
* gtk/testgtkrc:
|
||||||
Comment out property assignments, these don't work yet.
|
Comment out property assignments, these don't work yet.
|
||||||
|
|||||||
@ -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:
|
* gtk/testgtkrc:
|
||||||
Comment out property assignments, these don't work yet.
|
Comment out property assignments, these don't work yet.
|
||||||
|
|||||||
@ -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:
|
* gtk/testgtkrc:
|
||||||
Comment out property assignments, these don't work yet.
|
Comment out property assignments, these don't work yet.
|
||||||
|
|||||||
@ -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:
|
* gtk/testgtkrc:
|
||||||
Comment out property assignments, these don't work yet.
|
Comment out property assignments, these don't work yet.
|
||||||
|
|||||||
@ -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:
|
* gtk/testgtkrc:
|
||||||
Comment out property assignments, these don't work yet.
|
Comment out property assignments, these don't work yet.
|
||||||
|
|||||||
@ -117,7 +117,7 @@ gdk_pixbuf_unref (GdkPixbuf *pixbuf)
|
|||||||
static void
|
static void
|
||||||
free_buffer (guchar *pixels, gpointer data)
|
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;
|
channels = has_alpha ? 4 : 3;
|
||||||
rowstride = 4 * ((channels * width + 3) / 4);
|
rowstride = 4 * ((channels * width + 3) / 4);
|
||||||
|
|
||||||
buf = malloc (height * rowstride);
|
buf = g_try_malloc (height * rowstride);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ gdk_pixbuf_copy (const GdkPixbuf *pixbuf)
|
|||||||
size = ((pixbuf->height - 1) * pixbuf->rowstride +
|
size = ((pixbuf->height - 1) * pixbuf->rowstride +
|
||||||
pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));
|
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)
|
if (!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
@ -145,7 +145,7 @@ output_message_handler (j_common_ptr cinfo)
|
|||||||
static void
|
static void
|
||||||
free_buffer (guchar *pixels, gpointer data)
|
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;
|
w = cinfo.output_width;
|
||||||
h = cinfo.output_height;
|
h = cinfo.output_height;
|
||||||
|
|
||||||
pixels = malloc (h * w * 3);
|
pixels = g_try_malloc (h * w * 3);
|
||||||
if (!pixels) {
|
if (!pixels) {
|
||||||
jpeg_destroy_decompress (&cinfo);
|
jpeg_destroy_decompress (&cinfo);
|
||||||
|
|
||||||
|
|||||||
@ -176,7 +176,7 @@ png_simple_warning_callback(png_structp png_save_ptr,
|
|||||||
static void
|
static void
|
||||||
free_buffer (guchar *pixels, gpointer data)
|
free_buffer (guchar *pixels, gpointer data)
|
||||||
{
|
{
|
||||||
free (pixels);
|
g_free (pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shared library entry point */
|
/* Shared library entry point */
|
||||||
@ -230,7 +230,7 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
|
|||||||
else
|
else
|
||||||
bpp = 3;
|
bpp = 3;
|
||||||
|
|
||||||
pixels = malloc (w * h * bpp);
|
pixels = g_try_malloc (w * h * bpp);
|
||||||
if (!pixels) {
|
if (!pixels) {
|
||||||
/* Check error NULL, normally this would be broken,
|
/* Check error NULL, normally this would be broken,
|
||||||
* but libpng makes me want to code defensively.
|
* 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_set_IHDR (png_ptr, info_ptr, w, h, bpc,
|
||||||
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
||||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
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) {
|
if (data == NULL) {
|
||||||
/* Check error NULL, normally this would be broken,
|
/* Check error NULL, normally this would be broken,
|
||||||
@ -741,7 +741,7 @@ gdk_pixbuf__png_image_save (FILE *f,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
free (data);
|
g_free (data);
|
||||||
|
|
||||||
png_write_end (png_ptr, info_ptr);
|
png_write_end (png_ptr, info_ptr);
|
||||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
||||||
|
|||||||
@ -146,10 +146,10 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
int filter_level;
|
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);
|
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);
|
memset (dest_buf, 0x80, dest_rowstride * dest_height);
|
||||||
|
|
||||||
for (filter_level = GDK_INTERP_NEAREST ; filter_level <= GDK_INTERP_HYPER; filter_level++)
|
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");
|
printf ("\n");
|
||||||
|
|
||||||
free (src_buf);
|
g_free (src_buf);
|
||||||
free (dest_buf);
|
g_free (dest_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("SCALE\n=====\n\n");
|
printf ("SCALE\n=====\n\n");
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "gdk-pixbuf.h"
|
#include "gdk-pixbuf.h"
|
||||||
|
#include <gobject/gtype.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -229,6 +230,8 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
result = EXIT_SUCCESS;
|
result = EXIT_SUCCESS;
|
||||||
|
|
||||||
|
g_type_init (G_TYPE_DEBUG_NONE);
|
||||||
|
|
||||||
/* Run some tests. */
|
/* Run some tests. */
|
||||||
if (!simple_composite_test ()) {
|
if (!simple_composite_test ()) {
|
||||||
result = EXIT_FAILURE;
|
result = EXIT_FAILURE;
|
||||||
|
|||||||
@ -126,6 +126,11 @@ gdk_image_new_bitmap(GdkVisual *visual,
|
|||||||
image->bpp = 1;
|
image->bpp = 1;
|
||||||
image->bpl = (w+7)/8;
|
image->bpl = (w+7)/8;
|
||||||
image->mem = g_malloc (image->bpl * h / 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;
|
return image;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -430,7 +430,7 @@ gtk_calendar_init (GtkCalendar *calendar)
|
|||||||
widget = GTK_WIDGET (calendar);
|
widget = GTK_WIDGET (calendar);
|
||||||
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
|
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);
|
private_data = GTK_CALENDAR_PRIVATE_DATA (calendar);
|
||||||
|
|
||||||
if (!default_abbreviated_dayname[0])
|
if (!default_abbreviated_dayname[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user