This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug locale/19663] New: Change call from calloc() to xcalloc() in file 'id-collate.c'


https://sourceware.org/bugzilla/show_bug.cgi?id=19663

            Bug ID: 19663
           Summary: Change call from calloc() to xcalloc() in file
                    'id-collate.c'
           Product: glibc
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: wp02855 at gmail dot com
  Target Milestone: ---

Created attachment 9001
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9001&action=edit
patch file for above bug report (diff -u)

n directory 'glibc-2.22/locale/programs', file 'ld-collate.c', in
function 'read_directions' there is a call to calloc() which should
be changed to xcalloc() as all other memory allocations by calloc()
are defined as xcalloc().

The patch file below corrects this issue:

--- ld-collate.c.orig   2016-02-18 10:00:52.673070092 -0800
+++ ld-collate.c        2016-02-18 10:02:15.502597299 -0800
@@ -464,7 +464,7 @@
 {
   int cnt = 0;
   int max = nrules ?: 10;
-  enum coll_sort_rule *rules = calloc (max, sizeof (*rules));
+  enum coll_sort_rule *rules = xcalloc (max, sizeof (*rules));
   int warned = 0;
   struct locale_collate_t *collate = result->categories[LC_COLLATE].collate;

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]