svn commit: r281719 - head/bin/ed

2015-04-18 Thread Eitan Adler
Author: eadler
Date: Sat Apr 18 23:56:04 2015
New Revision: 281719
URL: https://svnweb.freebsd.org/changeset/base/281719

Log:
  bin/ed: use correct type in multiplication
The result is line_t** so the multiplication should be size *
sizeof(line_t*)
  
  MFC After:1 month

Modified:
  head/bin/ed/glbl.c

Modified: head/bin/ed/glbl.c
==
--- head/bin/ed/glbl.c  Sat Apr 18 23:49:57 2015(r281718)
+++ head/bin/ed/glbl.c  Sat Apr 18 23:56:04 2015(r281719)
@@ -153,7 +153,7 @@ set_active_node(line_t *lp)
if (active_list != NULL) {
 #endif
if ((ts = (line_t **) realloc(active_list,
-   (ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
+   (ti += MINBUFSZ) * sizeof(line_t *))) == NULL) {
fprintf(stderr, %s\n, strerror(errno));
errmsg = out of memory;
SPL0();
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r281719 - head/bin/ed

2015-04-18 Thread Pedro Giffuni


Oh yes ...
On 04/18/15 18:56, Eitan Adler wrote:

Author: eadler
Date: Sat Apr 18 23:56:04 2015
New Revision: 281719
URL: https://svnweb.freebsd.org/changeset/base/281719

Log:
   bin/ed: use correct type in multiplication
The result is line_t** so the multiplication should be size *
sizeof(line_t*)
   
   MFC After:	1 month


Modified:
   head/bin/ed/glbl.c

Modified: head/bin/ed/glbl.c
==
--- head/bin/ed/glbl.c  Sat Apr 18 23:49:57 2015(r281718)
+++ head/bin/ed/glbl.c  Sat Apr 18 23:56:04 2015(r281719)
@@ -153,7 +153,7 @@ set_active_node(line_t *lp)
if (active_list != NULL) {
  #endif
if ((ts = (line_t **) realloc(active_list,
-   (ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
+   (ti += MINBUFSZ) * sizeof(line_t *))) == NULL) {
fprintf(stderr, %s\n, strerror(errno));
errmsg = out of memory;
SPL0();



Found by:clang static checker

http://scan.freebsd.org/scan-build/bin/2015-04-18-amd64/report-9ba1bb.html#EndPath

;)

Thanks,

Pedro.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org