aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2024-05-02 21:24:20 +0100
committerTomasz Kramkowski <tomasz@kramkow.ski>2024-05-02 21:37:17 +0100
commit94f7d92631d87f968ffd559b2302aa1eb7cf840c (patch)
treef55225a1eb101525790484827e7cb296817f08ff /src/main.c
parentc4ee664d0b2f4e118106fdd49eb50d9fb3eaeee3 (diff)
Initialise getdelim buf pointers to NULL
getdelim can either be passed NULL or a malloc allocated buffer. I am not sure why on glibc on linux this doesn't outright crash, but it does crash on my ARM phone. By initialising to NULL, getdelim correctly allocates a buffer for the data rather than reallocating a string literal.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index de0abe7..2a6ed6b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,7 +49,7 @@ void sigint_handler(int signum) {
int main(int argc, char **argv) {
value_t *v;
size_t len = 0;
- char *buf = "";
+ char *buf = NULL;
/* Parsing arguments */
if (argc < 2) {