diff options
author | Petr Štetiar <ynezz@true.cz> | 2020-12-08 17:45:19 +0100 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-12-11 11:17:22 +0100 |
commit | 86a2ac6ac46ffb3f71e84debd03f7f16add148e5 (patch) | |
tree | b0eae1b70ca857f6e899cbb7616d6556ae7a2ce3 | |
parent | 158dd9dd289ca3fe1feb1c580ab2a8014d2ffb78 (diff) | |
download | uclient-86a2ac6ac46ffb3f71e84debd03f7f16add148e5.tar.gz |
uclient-fetch: fix potential memory leaks
Fixes following issue reported by clang-12 static analyzer:
uclient-fetch.c:612:25: warning: Potential leak of memory pointed to by 'username' [unix.Malloc]
memset(optarg, '*', strlen(optarg));
^~~~~~~~~~~~~~
uclient-fetch.c:618:25: warning: Potential leak of memory pointed to by 'password' [unix.Malloc]
memset(optarg, '*', strlen(optarg));
^~~~~~~~~~~~~~
Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r-- | uclient-fetch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/uclient-fetch.c b/uclient-fetch.c index 0c7a123..1c66ac6 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -608,13 +608,13 @@ int main(int argc, char **argv) case L_USER: if (!strlen(optarg)) break; - username = strdup(optarg); + username = strdupa(optarg); memset(optarg, '*', strlen(optarg)); break; case L_PASSWORD: if (!strlen(optarg)) break; - password = strdup(optarg); + password = strdupa(optarg); memset(optarg, '*', strlen(optarg)); break; case L_USER_AGENT: |