summaryrefslogtreecommitdiff
path: root/xcursorgen.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2004-12-03 22:21:22 +0000
committerKristian Høgsberg <krh@redhat.com>2004-12-03 22:21:22 +0000
commita750fa933a7d54c971badb401a23fcd020da315b (patch)
tree3d8775988c18cfa07ede4705e0f063c66b6f57a4 /xcursorgen.c
parent4b9f8a6bb5e2bd7129339264aab23f3818ff4952 (diff)
Diffstat (limited to 'xcursorgen.c')
-rw-r--r--xcursorgen.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/xcursorgen.c b/xcursorgen.c
index c07b186..60b2855 100644
--- a/xcursorgen.c
+++ b/xcursorgen.c
@@ -104,6 +104,12 @@ read_config_file (char *config, struct flist **list)
}
curr = malloc (sizeof (struct flist));
+ if (curr == NULL)
+ {
+ fprintf (stderr, "malloc() failed\n");
+ fclose (fp);
+ return 0;
+ }
curr->size = size;
curr->xhot = xhot;
@@ -112,6 +118,13 @@ read_config_file (char *config, struct flist **list)
curr->delay = delay;
curr->pngfile = malloc (strlen (pngfile) + 1);
+ if (curr->pngfile == NULL)
+ {
+ fprintf (stderr, "malloc() failed\n");
+ fclose (fp);
+ return 0;
+ }
+
strcpy (curr->pngfile, pngfile);
curr->next = NULL;
@@ -191,6 +204,12 @@ load_image (struct flist *list, char *prefix)
if (prefix)
{
file = malloc (strlen (prefix) + 1 + strlen (list->pngfile) + 1);
+ if (file == NULL)
+ {
+ fprintf (stderr, "malloc() failed\n");
+ png_destroy_read_struct (&png, &info, NULL);
+ return NULL;
+ }
strcpy (file, prefix);
strcat (file, "/");
strcat (file, list->pngfile);
@@ -250,6 +269,12 @@ load_image (struct flist *list, char *prefix)
image->delay = list->delay;
rows = malloc (sizeof (png_bytep) * height);
+ if (rows == NULL)
+ {
+ fclose (fp);
+ png_destroy_read_struct (&png, &info, NULL);
+ return NULL;
+ }
for (i = 0; i < height; i++)
rows[i] = (png_bytep) (image->pixels + i * width);