search for: realloc

Displaying 20 results from an estimated 1248 matches for "realloc".

Did you mean: regalloc
2015 Jul 06
5
[PATCH] for potential memory leaks
libFLAC has several places like this: if(0 == (ptr = realloc(ptr, size))) return false; which results in memory leaks if realloc fails (the old value of ptr is lost). The patch should fix this. -------------- next part -------------- A non-text attachment was scrubbed... Name: realloc_memleak_fix.patch Type: application/octet-stream Size: 6272 byte...
2017 Dec 26
3
Why is remalloc not marked as noalias?
Hello, According to my understanding, it seems that the result of realloc will not technically alias the original pointer. When the realloc is done in-place the reference <http://en.cppreference.com/w/c/memory/realloc> says: "The original pointer ptr is invalidated and any access to it is undefined behavior (even if reallocation was in-place)." Additiona...
2019 Sep 13
1
[PATCH nbdkit] common/bitmap: Don't fail on realloc (ptr, 0)
The following commands: nbdkit -fv --filter=cow memory size=512 --run 'qemu-img info $nbd' nbdkit -fv --filter=cache memory size=512 --run 'qemu-img info $nbd' both fail with: nbdkit: memory[1]: error: realloc: Success Initial git bisect pointed to commit 3166d2bcbfd2 (but I don't believe that commit is the real cause, it merely exposes the bug). The reason this happens is because the new behaviour after commit 3166d2bcbfd2 is to round down the size of the underlying disk to the cow/cache filter bl...
2009 Dec 21
2
Limit on number of times Realloc can be called?
Hello, I've been writing a program in C that will be called by R. I seem to have stumbled upon an odd error that seems to suggest there is a limit on the number of times "Realloc" (the R version as defined in the manual "R-extenstions" not the C version "realloc") when I try to use the following program: #include <R.h> #include <Rinternals.h> SEXP test_mem_alloc(SEXP z) { double *t = Calloc(sizeof(double), double); *t = 2; SEXP end_...
2018 Jul 20
1
[PATCH 2/2] Fix safe_realloc_add_2op_() to free memory when reallocation fails
--- include/share/alloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/share/alloc.h b/include/share/alloc.h index 914de9ba..63878db0 100644 --- a/include/share/alloc.h +++ b/include/share/alloc.h @@ -168,7 +168,7 @@ static inline void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2) free(ptr); return 0; } - return realloc(ptr, size2); + return safe_realloc_(ptr, size2); } static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3) -- 2.17.1
2019 Sep 15
2
[PATCH nbdkit v2] common/bitmap: Don't fail on realloc (ptr, 0)
v1 was here: https://www.redhat.com/archives/libguestfs/2019-September/msg00100.html In v2 I've changed the patch so it avoids calling realloc at all in this case. The patch is a bit longer this way. But I don't see any other alternative if we are to avoid having a "realloc wrapper" of some kind that we use everywhere, which I guess we should avoid because it makes plugins just that bit harder to write and we want them to...
2018 Jan 08
0
Why is remalloc not marked as noalias?
On 26 Dec 2017, at 10:13, Bhatu via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > According to my understanding, it seems that the result of realloc will not technically alias the original pointer. When the realloc is done in-place the reference says: > "The original pointer ptr is invalidated and any access to it is undefined behavior (even if reallocation was in-place)." > > Additionally from the C11 standard we have: >...
2019 Sep 15
0
[PATCH nbdkit v2] common/bitmap: Don't fail on realloc (ptr, 0)
The following commands: nbdkit -fv --filter=cow memory size=512 --run 'qemu-img info $nbd' nbdkit -fv --filter=cache memory size=512 --run 'qemu-img info $nbd' nbdkit -fv --filter=cow null --run 'qemu-img info $nbd' all fail with: nbdkit: memory[1]: error: realloc: Success Initial git bisect pointed to commit 3166d2bcbfd2 (this is not real cause, it merely exposes the bug). The reason this happens is because the new behaviour after commit 3166d2bcbfd2 is to round down the size of the underlying disk to the cow/cache filter block size. => Size of the un...
2012 Nov 05
2
New Memory Allocation
In Syslinux-5.00, is the goal that the core and .c32 modules alike will use the same heap? There is a bug I am thinking about: - QEmu with 1024 MiB RAM - Syslinux 4.06 - .c32 can realloc() up to 1013 MiB - QEmu with 1024 MiB RAM - Syslinux 5.00-pre9 - .c32 can realloc() up to 45 MiB I am wondering if there's a maximum-allocation-size being hit, or if it's actually a bug I should look for. - Shao Miller
2010 Oct 06
1
C code called from R: reallocate arrays passed as arguments?
..."switch" (with value 0 or 1) that states whether these "arguments" are really needed as arguments or not. When such switch is 0 (says "no"), the C code "feels free" to manipulate these "arguments", and in particular it tries to modify its extension (reallocate). To be clear: I define the "argument" in R: values1 <- double(size) values1 is passed as an argument in ".C". If the switch is set to 0 (says that "values1" is not a real argument), the C function tries to reallocate the pseudo-argument values1: double *tmp2...
2018 Apr 30
0
[PATCH 3/4] common/qemuopts: use the old pointer as realloc pointer
Call realloc() directly with the pointer to the old data, instead of assigning it to the destination variable, and using that one. The rest of the code is the same, already properly checking for the results of realloc(), so this mostly help static code analyzers. --- common/qemuopts/qemuopts.c | 6 ++---- 1 f...
2001 Dec 09
1
(fwd) Re: [Possible BUG]: Wine-20011108
...> invalid for 403a0344 > Heap: 403a0000 > > This looks like heap corruption. In > URLParser.cc:127: strcat ((char *) path, schema); > you scribble to path, but you have no storage allocated for path. > > So recheck you code. Thanks, for your analisys - the call to realloc () before the strcat () is unchecked indeed - however this means that wine fails repeatedly every call to realloc (). If you could give me any pointers how to debug further the problem I'll be glad to try and see whats going on exactly. Note that this code even with the unchecked calls to re...
2009 Oct 23
1
Confusion regarding allocating Matrices.
Hi I'm having slight confusion. I plan to grow/realloc a matrix depending on the data available in a C program. Here is what I'm tried to do: Data=allocMatrix(REALSXP,3,4); SEXP Data; REAL(Data)[8]=0.001123; REAL(Data)[200000]=0.001125; printf("%f %f\n\n\n\n",REAL(Data)[8],REAL(Data)[200000]); Here is my confusion: Do I always requi...
2015 Jun 30
3
[LLVMdev] readonly and infinite loops
...ntil we have the new pass manager. > > Interesting. Could you give an example why knowing a function will > halt is > essential for the heap-to-stack conversion? The key situation you need to establish in order to do heap-to-stack conversion, is that you can see the calls to free (or realloc, etc.) along all control-flow paths. If you can, then you can perform the conversion (because any additional calls to free that you can't observe would lead to a double free, and thus undefined behavior). Thus, if we have this situation: void bar(int *a); void foo() { int *a = (int*) malloc(...
2006 Jan 14
0
com32's realloc function
Hello list, I've been playing with com32 programs lately and I've come across a a problem with the realloc function in libcom32. The code that rounds up the size looks to be missing a '~' operator, resulting in it truncating every request to a size of 0-15 bytes. The little patch below fixes it up to match the corresponding line in malloc, which makes it work for me. K. diff -u /tmp/syslinux...
2006 Jun 25
2
Memory leak in 3.0.22?
...em resources exist to complete the requested service" At which point the Samba server becomes unresponsive to the current user logged in. At the same time, I am seeing alot of errors in the logs regarding memory allocation errors: --- [..snip extract..] [2006/06/25 22:03:48, 0] lib/util.c:Realloc(969) Memory allocation error: failed to expand to 4896 bytes [2006/06/25 22:03:48, 0] lib/util.c:Realloc(969) Memory allocation error: failed to expand to 4896 bytes [2006/06/25 22:03:48, 0] lib/util.c:Realloc(969) Memory allocation error: failed to expand to 4896 bytes [2006/06/25 22:03:5...
2006 Nov 21
1
1.2beta1 speex_bits_pack realloc issue?
In bits.c\speex_bits_pack there is logic to reallocate the bits buffer. In that section there is a call to speex_memset_bytes which appears to wipe out all the old bytes. I found when I encoded a multi-frame message that needed less than the default 2000 bytes for bits->chars, everything worked fine. However, when I encoded a longer message that...
2008 Mar 05
1
SEXP size management.
Hi, Trying to decrease the size of a SEXP variable without reassigning values individually in a loop. So far, I've tried using Realloc, as the follow source demonstrates: SEXP dothis() { SEXP Rblah; PROTECT(Rblah = NEW_INTEGER(6)); int* blah = INTEGER(Rblah); blah[0] = 1; blah[1] = 2; blah[2] = 3; Realloc(Rblah, 3, INTEGER); UNPROTECT(1); return(Rblah); } According to the documentation, I think that this should work,...
2008 Dec 19
2
Using realloc to remove MAX_LISTEN_SOCKS limit on sshd.c
OpenSSH developers, I have removed the fixed, arbitrary limit on the number of ListenAddress allowed by using realloc to dynamically expand listen_socks as needed. This completely removes MAX_LISTEN_SOCKS from the source. I made this change on the version of OpenSSH shipped with CentOS 5.2, version 4.3p2. Please see the attached .c file and .diff file. Please add these changes to OpenSSH to save people fro...
2015 May 29
2
[PATCH 1/3] inspection: Add func for merging fs inspections
...src->drive_mappings; + src->drive_mappings = NULL; + } else { + n = 0; + for (; dst->drive_mappings[n] != NULL; n++) + ; + old = n; + for (; src->drive_mappings[n] != NULL; n++) + ; + + /* Merge the src mappings to dst */ + mappings = realloc (dst->drive_mappings, (n + 1) * sizeof (char *)); + if (mappings == NULL) { + perrorf (g, "realloc"); + return -1; + } + + for (i = old; i < n; i++) + mappings[i] = src->drive_mappings[i - old]; + + mappings[n] = NULL; + dst->drive...