* key file.
*/
if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) {
+ /*
+ * This routine will take care of calling fclose() for us.
+ */
ret = loadrsakey_main(fp, key, FALSE, NULL, passphrase, &error);
goto end;
}
/*
* Otherwise, we have nothing. Return empty-handed.
*/
- fclose(fp);
error = "not an SSH-1 RSA file";
end:
+ fclose(fp);
if ((ret != 1) && errorstr)
*errorstr = error;
return ret;
*/
if (fgets(buf, sizeof(buf), fp) && !strcmp(buf, rsa_signature)) {
const char *dummy;
+ /*
+ * This routine will take care of calling fclose() for us.
+ */
return loadrsakey_main(fp, NULL, FALSE, comment, NULL, &dummy);
}
fclose(fp);
}
} else {
error = "not an SSH-1 RSA file";
- fclose(fp);
}
end:
+ if (fp)
+ fclose(fp);
if ((ret != 1) && errorstr)
*errorstr = error;
return ret;
sfree(public_blob);
sfree(private_blob);
sfree(encryption);
- *errorstr = NULL;
+ if (errorstr)
+ *errorstr = NULL;
return ret;
/*