diff options
author | Kristian Høgsberg <krh@redhat.com> | 2004-12-03 22:21:22 +0000 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2004-12-03 22:21:22 +0000 |
commit | a750fa933a7d54c971badb401a23fcd020da315b (patch) | |
tree | 3d8775988c18cfa07ede4705e0f063c66b6f57a4 /xcursorgen.c | |
parent | 4b9f8a6bb5e2bd7129339264aab23f3818ff4952 (diff) |
Check malloc return values.sco_port_update-baseXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901XORG-6_8_99_900XORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_16XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10XORG-6_8_99_1
Diffstat (limited to 'xcursorgen.c')
-rw-r--r-- | xcursorgen.c | 25 |
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); |