Merge pull request #45 from Guenael/guenael

fix(issue #42): Possible resource leaks
pull/46/head
Guenael, VA2GKA 2021-12-04 14:37:58 -05:00 zatwierdzone przez GitHub
commit f0896f7c95
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -445,12 +445,14 @@ int32_t readfile(float *iSamples, float *qSamples, char *filename) {
int32_t res = fseek(fd, 26, SEEK_SET);
if (res) {
fprintf(stderr, "Cannot set file offset...\n");
fclose(fd);
return 1;
}
int32_t nread = fread(filebuffer, sizeof(float), 2*SIGNAL_LENGHT*SIGNAL_SAMPLE_RATE, fd);
if (nread != 2*SIGNAL_LENGHT*SIGNAL_SAMPLE_RATE) {
fprintf(stderr, "Cannot read all the data!\n");
fclose(fd);
return 1;
}

Wyświetl plik

@ -479,17 +479,15 @@ int32_t wspr_decode(float *idat, float *qdat, uint32_t npoints,
w[i]=sinf(0.006147931*i);
}
if( options.usehashtable ) {
if ( options.usehashtable ) {
char line[80], hcall[12];
if( (fhash=fopen("hashtable.txt","r+")) ) {
if ( (fhash=fopen("hashtable.txt","r+")) ) {
while (fgets(line, sizeof(line), fhash) != NULL) {
sscanf(line,"%d %s",&nh,hcall);
strcpy(hashtab+nh*13,hcall);
}
} else {
fhash=fopen("hashtable.txt","w+");
}
fclose(fhash);
}
}
// Main loop starts here

Wyświetl plik

@ -120,7 +120,7 @@ void pack_prefix(char *callsign, int32_t *n, int32_t *m, int32_t *nadd ) {
*m=60000 + 26 + *m;
} else {
char* pfx=strtok(callsign,"/");
call6=strtok(NULL," ");
call6=strtok(pfx," "); // FIXME-CHECK
*n=pack_call(call6);
int plen=strlen(pfx);
if( plen ==1 ) {