Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Last active August 29, 2015 14:26
Show Gist options
  • Save fjolnir/f4569c01b52381ee9e51 to your computer and use it in GitHub Desktop.
Save fjolnir/f4569c01b52381ee9e51 to your computer and use it in GitHub Desktop.

Where:

  NSUInteger LEDataRangeLength(LEDataRange aRange) __attribute__((const));

The following:

    LEDataRange const dataRange = self.dataRange;
    if(LEDataRangeLength(dataRange) == 0)
        return NO;
    else {
        double *values = malloc(sizeof(double) * LEDataRangeLength(dataRange));

Causes the static analyzer to say:

  Call to 'malloc' has an allocation size of 0 bytes

Despite that dataRange & LEDataRangeLength being const, there's no chance of the length being 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment