pass the struct size to malloc(), not the pointer size.
found by GCC 12.
This commit is contained in:
parent
b44101216d
commit
a916878419
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: internals.c,v 1.42 2021/10/25 06:25:18 blymn Exp $ */
|
/* $NetBSD: internals.c,v 1.43 2023/08/01 07:56:23 mrg Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998-1999 Brett Lymn
|
* Copyright (c) 1998-1999 Brett Lymn
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: internals.c,v 1.42 2021/10/25 06:25:18 blymn Exp $");
|
__RCSID("$NetBSD: internals.c,v 1.43 2023/08/01 07:56:23 mrg Exp $");
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -3386,7 +3386,7 @@ _formi_calculate_tabs(_FORMI_FIELD_LINES *row)
|
||||||
for (i = 0, j = 0; i < row->length; i++, j++) {
|
for (i = 0, j = 0; i < row->length; i++, j++) {
|
||||||
if (row->string[i] == '\t') {
|
if (row->string[i] == '\t') {
|
||||||
if (*tsp == NULL) {
|
if (*tsp == NULL) {
|
||||||
if ((*tsp = malloc(sizeof(*tsp))) == NULL)
|
if ((*tsp = malloc(sizeof(**tsp))) == NULL)
|
||||||
return;
|
return;
|
||||||
(*tsp)->back = old_ts;
|
(*tsp)->back = old_ts;
|
||||||
(*tsp)->fwd = NULL;
|
(*tsp)->fwd = NULL;
|
||||||
|
|
Loading…
Reference in New Issue