Skip to content

Commit

Permalink
share: make reply free explicit in simple cases
Browse files Browse the repository at this point in the history
clang analyzer says that reply is unused.  This is a false
positive because, although we don't look at the reply,
we still need to free it.  So just explicitly call free
to quiet the check.

Signed-off-by: Bob Copeland <[email protected]>
  • Loading branch information
Bob Copeland committed Jun 7, 2017
1 parent 5760c2b commit 873482b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions endpoints-share.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int lastpass_share_user_mod(const struct session *session,
int lastpass_share_user_del(const struct session *session, const char *shareid,
struct share_user *user)
{
_cleanup_free_ char *reply = NULL;
char *reply = NULL;
size_t len;

reply = http_post_lastpass("share.php", session, &len,
Expand All @@ -202,6 +202,8 @@ int lastpass_share_user_del(const struct session *session, const char *shareid,
"delete", "1",
"uid", user->uid,
"xmlr", "1", NULL);

free(reply);
return 0;
}

Expand Down Expand Up @@ -286,14 +288,15 @@ int lastpass_share_create(const struct session *session, const char *sharename)

int lastpass_share_delete(const struct session *session, struct share *share)
{
_cleanup_free_ char *reply = NULL;
char *reply = NULL;
size_t len;

reply = http_post_lastpass("share.php", session, &len,
"token", session->token,
"id", share->id,
"delete", "1",
"xmlr", "1", NULL);
free(reply);
return 0;
}

Expand Down Expand Up @@ -382,7 +385,7 @@ int lastpass_share_set_limits(const struct session *session,
struct share_user *user,
struct share_limit *limit)
{
_cleanup_free_ char *reply = NULL;
char *reply = NULL;
_cleanup_free_ char *aid_buf = NULL;
char numaids_str[30] = {0};
struct share_limit_aid *aid;
Expand Down Expand Up @@ -416,5 +419,6 @@ int lastpass_share_set_limits(const struct session *session,
"aids", aid_buf,
"xmlr", "1", NULL);

free(reply);
return 0;
}

0 comments on commit 873482b

Please sign in to comment.