summaryrefslogtreecommitdiff
path: root/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.c')
-rw-r--r--lib/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/util.c b/lib/util.c
index eceaec9..671fcde 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -11,9 +11,10 @@ rs_strdup (struct rs_context *ctx, const char *s)
{
char *buf = rs_calloc (ctx, 1, strlen (s) + 1);
- if (buf != NULL)
- return strcpy (buf, s);
+ if (buf)
+ strcpy (buf, s);
+ else
+ rs_err_ctx_push (ctx, RSE_NOMEM, NULL);
- rs_err_ctx_push (ctx, RSE_NOMEM, NULL);
- return NULL;
+ return buf;
}