Skip to content

Commit

Permalink
no dereference before check
Browse files Browse the repository at this point in the history
  • Loading branch information
vlm committed Mar 14, 2016
1 parent f2b2f37 commit 034ee19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions skeletons/OCTET_STRING.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,16 +1712,18 @@ OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr,
void
OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
asn_OCTET_STRING_specifics_t *specs = td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
asn_struct_ctx_t *ctx = (asn_struct_ctx_t *)
((char *)st + specs->ctx_offset);
asn_OCTET_STRING_specifics_t *specs;
asn_struct_ctx_t *ctx;
struct _stack *stck;

if(!td || !st)
return;

specs = td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs;
ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);

ASN_DEBUG("Freeing %s as OCTET STRING", td->name);

if(st->buf) {
Expand Down
2 changes: 1 addition & 1 deletion skeletons/per_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ per_data_string(asn_per_data_t *pd) {
static char buf[2][32];
static int n;
n = (n+1) % 2;
snprintf(buf[n], sizeof(buf),
snprintf(buf[n], sizeof(buf[n]),
"{m=%ld span %+ld[%d..%d] (%d)}",
(long)pd->moved,
(((long)pd->buffer) & 0xf),
Expand Down

0 comments on commit 034ee19

Please sign in to comment.