aboutsummaryrefslogtreecommitdiffstats
path: root/src/wreadln.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-07 16:17:21 +0100
committerMax Kellermann <max@duempel.org>2008-11-07 16:17:21 +0100
commit521a026319775913bf828aa1c2de5ce5d717811c (patch)
tree11636d22a4fc7a10ab92a8fdda0286d1c66d8699 /src/wreadln.c
parent3eca95ac1cb786d1aef59fd141d75661903c039a (diff)
downloadmpd-521a026319775913bf828aa1c2de5ce5d717811c.tar.gz
mpd-521a026319775913bf828aa1c2de5ce5d717811c.tar.xz
mpd-521a026319775913bf828aa1c2de5ce5d717811c.zip
wreadln: return NULL instead of empty string
No wreadln() caller cares about an empty string. Simplify the callers by returning NULL instead of an allocated empty string. This fixes several memory leaks.
Diffstat (limited to 'src/wreadln.c')
-rw-r--r--src/wreadln.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wreadln.c b/src/wreadln.c
index df5b55e8c..a382fcecc 100644
--- a/src/wreadln.c
+++ b/src/wreadln.c
@@ -603,6 +603,9 @@ _wreadln(WINDOW *w,
}
}
+ if (wr.line[0] == 0)
+ return NULL;
+
return g_strdup(wr.line);
}