1
0
Fork 0

free bugs [fixed]

This commit is contained in:
Test_User 2024-06-16 21:30:55 -04:00
parent ae2932c5a3
commit e4768d794d

View file

@ -339,7 +339,6 @@ int opertype_handler(struct string sender, uint64_t argc, struct string *argv) {
return 1;
}
free(user->opertype.data);
struct string opertype = {.data = malloc(argv[0].len), .len = argv[0].len};
if (!opertype.data) {
WRITES(2, STRING("OOM! (opertype_handler)\n"));
@ -347,8 +346,7 @@ int opertype_handler(struct string sender, uint64_t argc, struct string *argv) {
}
memcpy(opertype.data, argv[0].data, argv[0].len);
if (user->opertype.len)
free(user->opertype.data);
free(user->opertype.data);
user->opertype = opertype;