ctx: Require dll parameter otherwise we are leaking it

This commit is contained in:
Jakub Jelen 2018-09-27 13:24:32 +02:00 committed by Frank Morgner
parent a85a4a8b48
commit 674e5e8b3d
1 changed files with 6 additions and 2 deletions

View File

@ -452,6 +452,10 @@ static void *load_dynamic_driver(sc_context_t *ctx, void **dll, const char *name
const char *(*modversion)(void) = NULL;
const char *(**tmodv)(void) = &modversion;
if (dll == NULL) {
sc_log(ctx, "No dll parameter specified");
return NULL;
}
if (name == NULL) { /* should not occur, but... */
sc_log(ctx, "No module specified");
return NULL;
@ -481,8 +485,8 @@ static void *load_dynamic_driver(sc_context_t *ctx, void **dll, const char *name
sc_dlclose(handle);
return NULL;
}
if (dll)
*dll = handle;
*dll = handle;
sc_log(ctx, "successfully loaded card driver '%s'", name);
return modinit(name);
}