diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-28 21:42:55 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-28 21:42:55 -0500 |
commit | 7c2b1baad8434f9f7b19efe48719942cb3bce4cd (patch) | |
tree | 79666a768eb3392ddea57a78c57531d00a145769 /src/strings.c | |
parent | 8b06e3e66a4cf26c02f9e0175263e1a561186c1b (diff) | |
download | spmc-7c2b1baad8434f9f7b19efe48719942cb3bce4cd.tar.gz |
Fix more memory leaks:
Add ability to free ManifestPackage structure
Fix bug: manifest_search pointer got free()ed accidentally.
Diffstat (limited to 'src/strings.c')
-rw-r--r-- | src/strings.c | 4 |
1 files changed, 2 insertions, 2 deletions
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'; } |