Callers shouldn't pass NULL (otherwise they can't tell if the function
failed or not), but there's nothing forcing the caller to check the
value anyway so let them pass NULL.
---
 lib/rpki/myssl.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/rpki/myssl.c b/lib/rpki/myssl.c
index 1caa45b..ca631b7 100644
--- a/lib/rpki/myssl.c
+++ b/lib/rpki/myssl.c
@@ -227,20 +227,23 @@ char *UnixTimeToDBTime(
 {
     struct tm *tmp;
     char *out;
+    int sta = 0;
 
-    if (stap == NULL)
-        return (NULL);
-    *stap = 0;
     out = (char *)calloc(48, sizeof(char));
     if (out == NULL)
     {
-        *stap = ERR_SCM_NOMEM;
-        return (NULL);
+        sta = ERR_SCM_NOMEM;
+        goto done;
     }
     tmp = gmtime(&clck);
     xsnprintf(out, 48, "%d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d",
               1900 + tmp->tm_year, 1 + tmp->tm_mon, tmp->tm_mday,
               tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+done:
+    if (stap)
+    {
+        *stap = sta;
+    }
     return (out);
 }
 
-- 
2.4.5


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
rpstir-devel mailing list
rpstir-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpstir-devel

Reply via email to