[Gluster-devel] Unchecked mallocs in libglusterfs

Jonathan Bringhurst fintler at gmail.com
Mon Dec 31 22:38:13 UTC 2007


Hey everyone,

This is my first time posting to the list and (as a disclaimer) I'm
generally a newbie to glusterfs and filesystems in general. I was
recently poking through the source (in the glusterfs-1.3.7 tarball)
and noticed a few unchecked mallocs. Here's a few examples...

**************************************
libglusterfs/src/common-utils.h:105

  struct iovec *newvec = malloc (bytecount);

  for (i=0;i<count;i++) {
    newvec[i].iov_len = vector[i].iov_len;

**************************************
libglusterfs/src/common-utils.h:169

  void *newptr = malloc (size);
  memcpy (newptr, ptr, size);

Is there any plan in place to get these cleaned up? I'd be happy to
create a nice diff, I'm just unsure as how to proceed. Are there
syscall wrappers located somewhere in the code base? Should I change
them to x*alloc? Any suggestions on the matter would be appreciated.

-Jon Bringhurst <fintler at gmail.com>

P.S. My current motivation on this is to become more familiar with the
codebase in general before I attempt to implement my (super secret)
idea for a translator ;)





More information about the Gluster-devel mailing list