mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
985 B

  1. http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html
  2. --- ./io.c 2005-07-26 21:07:43.000000000 +0300
  3. +++ ./io.c 2005-08-12 13:10:28.239852344 +0300
  4. @@ -2480,9 +2480,12 @@
  5. {
  6. struct stat sbuf;
  7. struct open_hook *oh;
  8. + int iop_malloced = FALSE;
  9. - if (iop == NULL)
  10. + if (iop == NULL) {
  11. emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
  12. + iop_malloced = TRUE;
  13. + }
  14. memset(iop, '\0', sizeof(IOBUF));
  15. iop->flag = 0;
  16. iop->fd = fd;
  17. @@ -2495,7 +2498,8 @@
  18. }
  19. if (iop->fd == INVALID_HANDLE) {
  20. - free(iop);
  21. + if (iop_malloced)
  22. + free(iop);
  23. return NULL;
  24. }
  25. if (isatty(iop->fd))
  26. @@ -2503,7 +2507,7 @@
  27. iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
  28. iop->sbuf = sbuf;
  29. if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
  30. - lintwarn(_("data file `%s' is empty"), name);
  31. + lintwarn(_("data file `%s' is empty"), name);
  32. errno = 0;
  33. iop->count = iop->scanoff = 0;
  34. emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");