Fix off by one error

Signed-off-by: Michal Čihař <michal@cihar.com>
Close file in error path

Signed-off-by: Michal Čihař <michal@cihar.com>
Close file in error path

Signed-off-by: Michal Čihař <michal@cihar.com>
Do not use uninitialized variables

Signed-off-by: Michal Čihař <michal@cihar.com>
Close file in error path

Signed-off-by: Michal Čihař <michal@cihar.com>
Close file in error path

Signed-off-by: Michal Čihař <michal@cihar.com>
Free memory in error path

Signed-off-by: Michal Čihař <michal@cihar.com>
Consistent size for NetworkCode

Signed-off-by: Michal Čihař <michal@cihar.com>