Роман Донченко <[email protected]> writes: >>> - if (DICT_FIND_VAL(&cache->protolibs, &key, retp) == 0) >>> + if (DICT_FIND_VAL(&cache->protolibs, &key, retp) == 0) { >>> + if (*retp != NULL && own_key) >>> + free((void *) key); >>> return 0; >>> + } >>> >>> if (strdup_if(&key, key, !own_key) < 0) { >>> fprintf(stderr, "Couldn't cache %s: %s\n", >> >> This looks like the wrong fix. The one who allocated the key should >> free it if protolib_cache_maybe_load returns a failure. > > But it returns a success here.
You are right, I didn't notice. Then it's fine. I'll push later today together with the other fixes. > In fact, I think we should take ownership of the key whenever the > function returns zero, no matter what's in *retp. What do you think? Yeah, if a key is passed in with own_key != 0, and the function returns zero (i.e. a success), the caller should assume the key has been consumed. Thanks, Petr _______________________________________________ Ltrace-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/ltrace-devel
