fix possible memory leak

This commit is contained in:
Krishna Vedala 2020-07-13 00:14:29 -04:00
parent f58916f8f5
commit 39cdc7b108
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7
1 changed files with 3 additions and 0 deletions

View File

@ -140,6 +140,9 @@ numbers. For safety, we make it twice the length of a number. */
if (!fp) if (!fp)
{ {
perror("Unable to open file 'num.txt'."); perror("Unable to open file 'num.txt'.");
free(txt_buffer);
free(sum);
free(number);
return -1; return -1;
} }