antirez / antirez/rax

valgrind complains about uninitialized memory

Offen
#14 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C
Sterne
1.3k
Forks
177
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

The nodes are allocated with malloc and often not initialized.
I'm not sure that it's a real problem, but perhaps it's better to use calloc instead of malloc.
```patch
diff --git a/app/jni/rax_malloc.h b/app/jni/rax_malloc.h
index e9d5d5d7b..2ebe00665 100755
--- a/app/jni/rax_malloc.h
+++ b/app/jni/rax_malloc.h
@@ -37,7 +37,7 @@

#ifndef RAX_ALLOC_H
#define RAX_ALLOC_H
-#define rax_malloc malloc
+#define rax_malloc(s) calloc(1, s)
#define rax_realloc realloc
#define rax_free free
#endif
```

If you want I can create a PR.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.