]> diplodocus.org Git - nmh/blobdiff - sbr/oauth.c
Use mh_xstrdup() instead of getcpy() for a string constant.
[nmh] / sbr / oauth.c
index 0cc95e4e3c2ccf0f073a8dd05aefbb520bd088cd..22e69874701331df8f288e2d8e20449c30461f4b 100755 (executable)
@@ -255,8 +255,10 @@ make_user_agent()
 boolean
 mh_oauth_new(mh_oauth_ctx **result, const char *svc_name)
 {
 boolean
 mh_oauth_new(mh_oauth_ctx **result, const char *svc_name)
 {
-    mh_oauth_ctx *ctx = *result = mh_xmalloc(sizeof *ctx);
+    mh_oauth_ctx *ctx;
 
 
+    NEW(ctx);
+    *result = ctx;
     ctx->curl = NULL;
 
     ctx->log = NULL;
     ctx->curl = NULL;
 
     ctx->log = NULL;
@@ -507,7 +509,7 @@ mh_oauth_authorize(const char *code, mh_oauth_ctx *ctx)
         return NULL;
     }
 
         return NULL;
     }
 
-    result = mh_xmalloc(sizeof *result);
+    NEW(result);
     result->ctx = ctx;
     result->access_token = result->refresh_token = NULL;
 
     result->ctx = ctx;
     result->access_token = result->refresh_token = NULL;
 
@@ -622,7 +624,8 @@ load_creds(struct user_creds **result, FILE *fp, mh_oauth_ctx *ctx)
     int state;
     m_getfld_state_t getfld_ctx = 0;
 
     int state;
     m_getfld_state_t getfld_ctx = 0;
 
-    struct user_creds *user_creds = mh_xmalloc(sizeof *user_creds);
+    struct user_creds *user_creds;
+    NEW(user_creds);
     user_creds->alloc = 4;
     user_creds->len = 0;
     user_creds->creds = mh_xmalloc(user_creds->alloc * sizeof *user_creds->creds);
     user_creds->alloc = 4;
     user_creds->len = 0;
     user_creds->creds = mh_xmalloc(user_creds->alloc * sizeof *user_creds->creds);