Skip to content

sp_init has dead code but could call free twice #168

@SamHerts

Description

@SamHerts

Bug:

spindle_ctx_destroy doesn't get called since logerrno_printf_and_return macro expands with its own return. ctx will still be freed in destructor but potential for double free.

rc = spindle_in_session_mode(h, NULL, NULL);
if (rc == -1) {
logerrno_printf_and_return(1, "failed to read session info from flux\n");
spindle_ctx_destroy(ctx);
return -1;

macro:

#define logerrno_printf_and_return(PRIORITY, FORMAT, ...) \
do { \
int log_errno_result; \
spindle_debug_printf(PRIORITY, FORMAT, ## __VA_ARGS__); \
log_errno_result = shell_log_errno(FORMAT, ## __VA_ARGS__); \
return log_errno_result; \
} while (0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions