Displaying 20 results from an estimated 920 matches for "calloc".
Did you mean:
alloc
2015 Jun 18
1
[PATCH] error log: keep more calloc and its error messages match
...| 6 +++---
11 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/cat/cat.c b/cat/cat.c
index 5a438ce..82f0055 100644
--- a/cat/cat.c
+++ b/cat/cat.c
@@ -191,7 +191,7 @@ main (int argc, char *argv[])
access (argv[optind], F_OK) == 0) { /* simulate -a option */
drv = calloc (1, sizeof (struct drv));
if (!drv) {
- perror ("malloc");
+ perror ("calloc");
exit (EXIT_FAILURE);
}
drv->type = drv_a;
@@ -205,7 +205,7 @@ main (int argc, char *argv[])
} else { /* simulate -d...
2006 Apr 13
2
Calloc : syntax error
Hi,
I have issue with Calloc : at the compilation step, gcc tells "error :
syntax error before ')' token".
When I use the classical C calloc... free, everything's fine.
Here's the part of code :
a = (double*) Calloc(*n,sizeof(double));
when i remove this line or replace it with the calloc, it's o...
2005 Dec 29
1
Problems with calloc function.
Hi all,
I have a C code in Linux, it has 7 pointers and compile e run OK, but when I
run in R happens problems with calloc function, it returns NULL.
###############################################
> int *temp1,*temp2,*temp3,*temp4;
temp1 = (int *)calloc(col,sizeof(int));
if(temp1 == NULL){
printf("\n\n No Memory1!");
exit(1);
}
temp2 = (int *)calloc(col,sizeof(int));
if(temp2 == NULL){...
2024 Aug 13
1
[PATCH] Reorder calloc arguments
Reordering calloc arguments silences gcc compiler warnings of
latest versions. Spotted with OpenSSH-portable on a Linux system.
Okay?
Index: cipher.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/cipher.c,v
diff -u -p -u -p -r1.121 cipher.c
--- cipher.c 17 May 2...
2006 Apr 17
1
[patch] calloc arguments
Hi, it looks like a few users of calloc had their arguments backwards. I
checked the other users and they seem fine.
Since one of those is in ioemu code, does that mean we (I?) will be
submitting that bug to qemu upstream?
--
Hollis Blanchard
IBM Linux Technology Center
Fix swapped calloc() arguments.
Signed-off-by: Hollis Blanchard...
2012 Mar 18
2
malloc/calloc/strdup and R's aequivalents
Hello,
when looking at "Writing R Extensions"
with mem-allocation in mind, I wondered,
which functions to use to substitute
malloc(), calloc(), realloc() and strdup() and free().
It looked like Calloc() or R_Calloc() might be useful for
some of my tasks, but when trying to use R_Calloc() for example,
I got some error messages which I don't see where they are coming from.
Maybe I just have forgotten to includ ethe right header file...
2015 Jun 17
2
[PATCH] btrfs: keep calloc and its error message match
...c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 7b14bac..e8059db 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -479,7 +479,7 @@ do_btrfs_subvolume_list (const mountable_t *fs)
ret->guestfs_int_btrfssubvolume_list_val =
calloc (nr_subvolumes, sizeof (struct guestfs_int_btrfssubvolume));
if (ret->guestfs_int_btrfssubvolume_list_val == NULL) {
- reply_with_perror ("malloc");
+ reply_with_perror ("calloc");
goto error;
}
@@ -1292,7 +1292,7 @@ do_btrfs_qgroup_show (const char *path)...
2020 Jun 07
3
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
...ointer to NULL. At that point of tcltk.c, we have
> >
> > for (objc = i = 0; i < length(avec); i++){
> > const char *s;
> > char *tmp;
> > if (!isNull(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){
> > // tmp = calloc(strlen(s)+2, sizeof(char));
> > tmp = Calloc(strlen(s)+2, char);
> > *tmp = '-';
> > strcpy(tmp+1, s);
> > objv[objc++] = Tcl_NewStringObj(tmp, -1);
> > free(tmp);
> > }
> > if (!i...
2020 Jun 07
4
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
I've committed the change to use Free instead of free in tcltk.c and
sys-std.c (r78652 for R-devel, r78653 for R-patched).
We might consider either moving Calloc/Free out of the Windows
remapping or moving the remapping into header files so everything
seeing our header files uses our calloc/free. Either would be less
brittle that the current status.
Best,
luke
On Sun, 7 Jun 2020, peter dalgaard wrote:
>
>
>> On 7 Jun 2020, at 18:59 , Jeroen...
2020 Jun 07
5
use of the tcltk package crashes R 4.0.1 for Windows
...not freeing a null pointer, followed by setting the pointer to NULL. At that point of tcltk.c, we have
for (objc = i = 0; i < length(avec); i++){
const char *s;
char *tmp;
if (!isNull(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){
// tmp = calloc(strlen(s)+2, sizeof(char));
tmp = Calloc(strlen(s)+2, char);
*tmp = '-';
strcpy(tmp+1, s);
objv[objc++] = Tcl_NewStringObj(tmp, -1);
free(tmp);
}
if (!isNull(t = VECTOR_ELT(avec, i)))
objv[objc++] = (Tcl...
2020 Jun 07
0
[External] use of the tcltk package crashes R 4.0.1 for Windows
Ah, I see it now:
The remapping of free() to Rm_free() and calloc() to Rm_calloc() happens in memory.c, but not in tcltk.c; the macro Calloc in R_ext/RS.h maps to a call to R_chk_alloc which is defined in memory.h; RS.h is included in tcltk.c, so tcltk.c winds up calling Rm_calloc() via Calloc(), but then the NON-remapped free(), and the walls come tumbling down....
2015 Aug 27
2
[Mesa-dev] gallium state tracker calls calloc for 0 sizes arrays ?
...ted memory corruption replayed
>> it using ElectrFence + glretrace, this finds a 0 sized array
>> allocation at src/mesa/state_tracker/st_glsl_to_tgsi.cpp: 5565:
>>
>> if (proginfo->Parameters) {
>> t->constants = (struct ureg_src *)
>> calloc(proginfo->Parameters->NumParameters,
>> sizeof(t->constants[0]));
>>
>> And if I protect the code against that one, another one at 5618:
>>
>> t->immediates = (struct ureg_src *)
>> calloc(program->num_immediates, sizeof(struct ureg_src)...
2015 Aug 27
2
gallium state tracker calls calloc for 0 sizes arrays ?
...single slide transition
animation, and since I suspected memory corruption replayed
it using ElectrFence + glretrace, this finds a 0 sized array
allocation at src/mesa/state_tracker/st_glsl_to_tgsi.cpp: 5565:
if (proginfo->Parameters) {
t->constants = (struct ureg_src *)
calloc(proginfo->Parameters->NumParameters, sizeof(t->constants[0]));
And if I protect the code against that one, another one at 5618:
t->immediates = (struct ureg_src *)
calloc(program->num_immediates, sizeof(struct ureg_src));
With the regular glibc malloc these both succeed...
2015 Jun 17
0
Re: [PATCH] btrfs: keep calloc and its error message match
On Wednesday 17 June 2015 10:44:09 Chen Hanxiao wrote:
> commit 3f4ba2e98d21746723d291939ccc2e1f1526aa6d
> left some error messages unchanged.
That commit was about converting a couple of malloc+memset to calloc,
not about replacing messages in other parts. Hence, this note is wrong.
>
> Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
> ---
> daemon/btrfs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/daemon/btrfs.c b/daemon/btrfs.c
&g...
2005 Dec 14
1
R-beta on AIX5.2
...rc/nmath'
xlc_r -I. -I../../src/include -I../../src/include -I/usr/local/include
-I/opt/freeware/include -DHAVE_CONFIG_H -q64 -I/usr/local/include
-I/opt/freeware/include -O2 -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT -c
mlutils.c -o mlutils.o
"nmath.h", line 50.9: 1506-213 (S) Macro name calloc cannot be
redefined.
"nmath.h", line 50.9: 1506-358 (I) "calloc" is defined on line 641 of
/usr/include/stdlib.h.
make[3]: *** [mlutils.o] Error 1
--- R-beta.orig/src/nmath/nmath.h 2005-10-06 19:25:25.000000000 +0900
+++ R-beta/src/nmath/nmath.h 2005-12-13 19:33:59.000000000 +...
2018 May 03
1
[PATCH] daemon: fix memory allocation and leaks in OCaml stubs
Use the cleanup handlers to free the structs (and list of structs) in
case their OCaml->C transformation fails for any reason; use calloc()
to not try to use uninitialized memory.
In case of lists, avoid allocating the memory for the array if there
are no elements, since the returned pointer in that case is either NULL,
or a free()-only pointer; also, set the list size only after the array
is allocated, to not confuse the XDR routin...
2015 Jun 16
1
[PATCH] btrfs: use calloc instead of malloc+memset
...ged, 4 insertions(+), 6 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index f02acb1..7b14bac 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1723,12 +1723,11 @@ do_btrfs_balance_status (const char *path)
nlines = count_strings (lines);
- ret = malloc(sizeof *ret);
+ ret = calloc (1, sizeof *ret);
if (ret == NULL) {
- reply_with_perror ("malloc");
+ reply_with_perror ("calloc");
goto error;
}
- memset (ret, 0, sizeof(*ret));
/* Output of `btrfs balance status' is like:
*
@@ -1850,12 +1849,11 @@ do_btrfs_scrub_status (const...
2009 Nov 03
1
hivex.c: unchecked calloc
Hi Rich,
There's an unchecked calloc in hivex.c's hive_open:
h->bitmap = calloc (1 + h->size / 32, 1);
...
This subsequent deref could cause a segfault:
BITMAP_SET (h->bitmap, blkoff);
2001 Jan 05
1
segfault when calling C code
Hi, all.
I've got some C code that I've used successfully, and fairly extensively,
in R-1.1.1, which is suddenly causing segmentation faults in R-1.2.0. The
original code used calloc (just plain calloc) with a free at the end, but
I've tried replacing the calloc with R_alloc (based on the Writing R
extensions documentation, which I'm not sure I've understood properly),
and also passing in variables with enough space (I know how much it will
be). Neither change gets...
2018 Aug 06
1
[PATCH] btrfs_balance_status: delay allocation of 'ret'
...--
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 26757d4fb..5c4be6cf7 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1683,12 +1683,6 @@ do_btrfs_balance_status (const char *path)
nlines = guestfs_int_count_strings (lines);
- ret = calloc (1, sizeof *ret);
- if (ret == NULL) {
- reply_with_perror ("calloc");
- return NULL;
- }
-
/* Output of `btrfs balance status' is like:
*
* running:
@@ -1711,6 +1705,12 @@ do_btrfs_balance_status (const char *path)
return NULL;
}
+ ret = calloc (1, sizeo...