Annotation of /trunk/xorg-old/patches-6.8.2-r10/9180_all_4.3.0-xcursorgen-check-malloc-return.patch
Parent Directory | Revision Log
Revision 167 -
(hide annotations)
(download)
Tue May 8 20:58:51 2007 UTC (17 years, 1 month ago) by niro
File size: 856 byte(s)
Tue May 8 20:58:51 2007 UTC (17 years, 1 month ago) by niro
File size: 856 byte(s)
-import
1 | niro | 167 | --- xc/programs/xcursorgen/xcursorgen.c.xcursorgen-check-malloc-return 2004-02-25 17:08:37.000000000 -0500 |
2 | +++ xc/programs/xcursorgen/xcursorgen.c 2004-02-25 17:17:01.000000000 -0500 | ||
3 | @@ -103,7 +103,11 @@ | ||
4 | } | ||
5 | } | ||
6 | |||
7 | - curr = malloc (sizeof (struct flist)); | ||
8 | + if (NULL == (curr = malloc (sizeof (struct flist)))) | ||
9 | + { | ||
10 | + fprintf (stderr, "malloc() failed\n"); | ||
11 | + return 1; | ||
12 | + } | ||
13 | |||
14 | curr->size = size; | ||
15 | curr->xhot = xhot; | ||
16 | @@ -190,7 +194,11 @@ | ||
17 | |||
18 | if (prefix) | ||
19 | { | ||
20 | - file = malloc (strlen (prefix) + 1 + strlen (list->pngfile) + 1); | ||
21 | + if (NULL == (file = malloc (strlen (prefix) + 1 + strlen (list->pngfile) + 1))) | ||
22 | + { | ||
23 | + fprintf (stderr, "malloc() failed\n"); | ||
24 | + return 1; | ||
25 | + } | ||
26 | strcpy (file, prefix); | ||
27 | strcat (file, "/"); | ||
28 | strcat (file, list->pngfile); |