Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
>
Examples of errors detected by the V772…

Examples of errors detected by the V772 diagnostic

V772. Calling the 'delete' operator for a void pointer will cause undefined behavior.


Haiku Operation System

V772 Calling a 'delete' operator for a void pointer will cause undefined behavior. Hashtable.cpp 207


void
Hashtable::MakeEmpty(int8 keyMode,int8 valueMode)
{
  ....
  for (entry = fTable[index]; entry; entry = next) {
    switch (keyMode) {
      case HASH_EMPTY_DELETE:
        // TODO: destructors are not called!
        delete (void*)entry->key;
        break;
      case HASH_EMPTY_FREE:
        free((void*)entry->key);
        break;
    }
    switch (valueMode) {
      case HASH_EMPTY_DELETE:
        // TODO: destructors are not called!
        delete entry->value;
        break;
      case HASH_EMPTY_FREE:
        free(entry->value);
        break;
    }
    next = entry->next;
    delete entry;
  }
  ....
}

Command & Conquer

V772 Calling a 'delete' operator for a void pointer will cause undefined behavior. ENDING.CPP 254


void GDI_Ending(void)
{
  ....
  void * localpal = Load_Alloc_Data(CCFileClass("SATSEL.PAL"));
  ....
  delete [] localpal;
  ....
}

Similar errors can be found in some other places:

  • V772 Calling a 'delete' operator for a void pointer will cause undefined behavior. HEAP.CPP 284
  • V772 Calling a 'delete' operator for a void pointer will cause undefined behavior. INIT.CPP 728
  • V772 Calling a 'delete' operator for a void pointer will cause undefined behavior. MIXFILE.CPP 134
  • And 18 additional diagnostic messages.

Overgrowth

V772 [CERT-MSC15-C] Calling a 'delete' operator for a void pointer will cause undefined behavior. OVR_CAPI_Util.cpp 380


typedef struct ovrHapticsClip_
{
  const void* Samples;
  ....
} ovrHapticsClip;
....

OVR_PUBLIC_FUNCTION(void) ovr_ReleaseHapticsClip(ovrHapticsClip* hapticsClip)
{
  if (hapticsClip != NULL && hapticsClip->Samples != NULL)
  {
    delete[] hapticsClip->Samples;
  ....
  }
}

Qt Creator

V772 [CWE-758, CERT-MSC15-C] Calling a 'delete' operator for a void pointer will cause undefined behavior. containers.cpp 26


static void *readPointerArray(ULONG64 address, unsigned count,
                              const SymbolGroupValueContext &ctx)
{
  const unsigned pointerSize = SymbolGroupValue::pointerSize();
  const ULONG allocSize = pointerSize * count;
  ULONG bytesRead = 0;
  void *data = new unsigned char[allocSize];
  const HRESULT hr = ctx.dataspaces->ReadVirtual(address, data, allocSize,
                                                 &bytesRead);
  if (FAILED(hr) || bytesRead != allocSize)
  {
    delete [] data; // <=
    return 0;
  }

  return data;
}