Skip to content
Permalink
Browse files

sdsfree everything before return'ing

1970df3 introduces some sds uses,
and they all seem alright. However, in two cases, they are in
situations where there's a code path that meets a 'return'. In
those cases, sdsfree must be called before return.
  • Loading branch information
marado committed Apr 9, 2019
1 parent a3c904e commit eb86e9de8d1f3c79a3c3e55fbd0fc620e7773264
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/amnuts230.c
@@ -4030,6 +4030,7 @@ dump_commands(int sig)
filename = sdscatfmt(sdsempty(), "%s/%s.%s", LOGFILES, LAST_CMD, dstr);
fp = fopen(filename, "w");
if (!fp) {
sdsfree(filename);
return;
}
fprintf(fp, "Caught signal %d:\n\n", sig);
@@ -4303,6 +4304,7 @@ add_history(char *username, int showtime, const char *str, ...)
filename = sdscatfmt(sdsempty(), "%s/%s/%s.H", USERFILES, USERHISTORYS, username);
fp = fopen(filename, "a");
if (!fp) {
sdsfree(filename);
return;
}
time(&now);

0 comments on commit eb86e9d

Please sign in to comment.
You can’t perform that action at this time.