aboutsummaryrefslogtreecommitdiffstats
path: root/src/stdlib/relpath.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-19 19:07:55 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-19 19:07:55 +0100
commitbbecbc321150c8b1f2bf43149cea0708958c9b09 (patch)
treec9dd9e19d5ec5bd5415274246765902b457a4fbe /src/stdlib/relpath.c
parentdoc (diff)
downloadslibc-bbecbc321150c8b1f2bf43149cea0708958c9b09.tar.gz
slibc-bbecbc321150c8b1f2bf43149cea0708958c9b09.tar.bz2
slibc-bbecbc321150c8b1f2bf43149cea0708958c9b09.tar.xz
fix issue #2
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/stdlib/relpath.c')
-rw-r--r--src/stdlib/relpath.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/stdlib/relpath.c b/src/stdlib/relpath.c
index 92888fa..e3d7e24 100644
--- a/src/stdlib/relpath.c
+++ b/src/stdlib/relpath.c
@@ -56,6 +56,8 @@ char* relpath(const char* file, const char* ref) /* XXX may also fail as get_cur
{
p = strlen(cwd);
absref = malloc((p + 1) + sizeof(char));
+ if (absref == NULL)
+ goto fail;
memcpy(absref, cwd, p);
absref[p] = '/';
absref[p + 1] = '\0';