From 7c2b1baad8434f9f7b19efe48719942cb3bce4cd Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 28 Jan 2020 21:42:55 -0500 Subject: Fix more memory leaks: Add ability to free ManifestPackage structure Fix bug: manifest_search pointer got free()ed accidentally. --- src/strings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/strings.c') diff --git a/src/strings.c b/src/strings.c index 46ef9ea..29d5b65 100644 --- a/src/strings.c +++ b/src/strings.c @@ -451,12 +451,12 @@ char *lstrip(char *sptr) { * @return truncated string */ char *strip(char *sptr) { - size_t len = strlen(sptr); + size_t len = strlen(sptr) - 1; if (len < 1) { *sptr = '\0'; return sptr; } - for (size_t i = len - 1; ; i--) { + for (size_t i = len; ; i--) { if (isspace(sptr[i]) || isblank(sptr[i])) { sptr[i] = '\0'; } -- cgit