From: Nathan Wagner Date: Mon, 26 Nov 2018 05:20:00 +0000 (+0000) Subject: fix bugs reported by static analyzer X-Git-Tag: v0.3.0~22 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=339988d64465820bfce614d4939cdf6a03cd3c51 fix bugs reported by static analyzer --- diff --git a/lib/integ.c b/lib/integ.c index 81667ea..57e7d87 100644 --- a/lib/integ.c +++ b/lib/integ.c @@ -127,6 +127,10 @@ static void hash_query(struct zpm *zpm, const char *zSql, struct sha256_state *h hash_byte(h, 'B'); hash_int(h, bytes); break; + default: + hash_byte(h, 'U'); + continue; + break; } sha256_process(h, data, bytes); } diff --git a/lib/zpm.c b/lib/zpm.c index 359c095..9b208cc 100644 --- a/lib/zpm.c +++ b/lib/zpm.c @@ -398,6 +398,7 @@ int zpm_extract(struct zpm *pkg, char *hash, char *path, mode_t mode) { tmpfile, strerror(errno)); sqlite3_finalize(ifile); sqlite3_close(db); + free(tmpfile); return 0; } } else { @@ -432,6 +433,7 @@ int zpm_extract(struct zpm *pkg, char *hash, char *path, mode_t mode) { } } + free(tmpfile); return rc; } diff --git a/zpm-packagehash.c b/zpm-packagehash.c index 6ca53af..6d5b912 100644 --- a/zpm-packagehash.c +++ b/zpm-packagehash.c @@ -80,12 +80,10 @@ int main(int ac, char **av){ } zpm_close(&pkg); - if (current) { - free(current); - } if (display && !quiet) { printf("%s\n", display); } + free(current); } return checkfail ? EXIT_FAILURE : 0; diff --git a/zpm-quote.c b/zpm-quote.c index 97e4fe6..1aea24b 100644 --- a/zpm-quote.c +++ b/zpm-quote.c @@ -88,6 +88,7 @@ int main(int ac, char **av) { for (i=argn;i