diff --git a/common/bstrlib/bstrlib.c b/common/bstrlib/bstrlib.c index e44e76d..0c051f6 100644 --- a/common/bstrlib/bstrlib.c +++ b/common/bstrlib/bstrlib.c @@ -2398,7 +2398,10 @@ int i, c, v; } else { v = (bl->qty - 1) * len; if ((bl->qty > 512 || len > 127) && - v / len != bl->qty - 1) return NULL; /* Overflow */ + v / len != bl->qty - 1) { + bstr__free (b); + return NULL; /* Overflow */ + } if (v > INT_MAX - c) { bstr__free (b); return NULL; /* Overflow */