Fix an undefined behaviour and a memory leak (#289)
* Use a unique_ptr to avoid leaks * Use memmove instead of memcopy As both arguments can overlap, use memmove instead of memcopy * Fix code style issues
This commit is contained in:
parent
e4a1ebf00e
commit
849832a951
|
|
@ -2963,6 +2963,7 @@ Sta::netSlack(const Net *net,
|
|||
slack = pin_slack;
|
||||
}
|
||||
}
|
||||
delete pin_iter;
|
||||
return slack;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public:
|
|||
int n_putback = gptr() - eback();
|
||||
if ( n_putback > 4)
|
||||
n_putback = 4;
|
||||
memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback);
|
||||
memmove( buffer + (4 - n_putback), gptr() - n_putback, n_putback);
|
||||
|
||||
int num = gzread( file, buffer+4, bufferSize-4);
|
||||
if (num <= 0) // ERROR or EOF
|
||||
|
|
|
|||
Loading…
Reference in New Issue